Go Back   2023 2024 Courses.Ind.In > Main Category > Main Forum

  #1  
Old July 1st, 2016, 04:22 PM
Senior Member
 
Join Date: May 2015
Default js format date string

Discuss about js format date string here. Welcome to Courses.ind.in and this page is for js format date string discussion. If you are looking for information on js format date string then ask your question is as much details as possible in the “Reply” box provided below. The more detailed your question will be, the more easy will it be for our experts to answers your query. And if you have any updated or latest information on js format date string, then please share you knowledge with our experts in the “Reply” box below. Your reply will be published here and your knowledge can help many people. Thanks for stopping by at Courses.ind.in. Please visit again.
Reply With Quote Quick reply to this message
  #2  
Old May 2nd, 2017, 08:39 AM
Unregistered
Guest
 
Default Re: js format date string

How to format Date and Time Strings using JavaScript programming language , for that I need your help?
Reply With Quote Quick reply to this message
  #3  
Old May 2nd, 2017, 08:40 AM
Super Moderator
 
Join Date: Aug 2012
Default Re: js format date string

I will tell you way to use JavaScript programming language for formatting Date and Time Strings, so that you can apply the same.

The following example shows how to use to Locale Date String and to Locale Time String to format dates and times.

The first parameter passed to these methods is a locale value, such as "en-us". The second parameter, where present, specifies formatting options, such as the long form for the weekday.

Example
var date = new Date(Date.UTC(2013, 1, 1, 14, 0, 0));
var options = {
weekday: "long", year: "numeric", month: "short",
day: "numeric", hour: "2-digit", minute: "2-digit"
};

document.write(date.toLocaleDateString("en-US"));
document.write(date.toLocaleTimeString("en-us", options));
document.write(date.toLocaleDateString("ja-JP"));
document.write(date.toLocaleTimeString("ja-JP", options));

// Output:
// ‎2‎/‎1‎/‎2013
// ‎Friday‎, ‎Feb‎ ‎1‎, ‎2013‎ ‎06‎:‎00‎ ‎AM
// ‎2013‎年‎2‎月‎1‎日‎
// ‎2013‎年‎2‎月‎1‎日 ‎金曜日‎ ‎06‎:‎00

Formatting Dates
Before Internet Explorer 11, JavaScript did not have specific methods to format dates and times.

To provide your own date formatting for previous browser versions, use the getDay Method (Date), getDate Method (Date), getMonth Method (Date), and getFullYear Method (Date) methods. (The getYear Method (Date) is obsolete and should not be used.)

var myDate = new Date("February 3, 2001");
var myDate = new Date("February 3 2001");
document.write((myDate.getMonth() + 1) + "-" + myDate.getDate() + "-" + myDate.getFullYear());
document.write("<br/>");
document.write((myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear());

//Output:
// 2-3-2001
// 2/3/2001
Reply With Quote Quick reply to this message
Reply
Similar Threads
Thread
Format CV Download
Format Factory Download For Windows XP
Download resume format for MBA
Free Ebooks Download In Pdf Format For IIT-JEE
MPPSC Download Format
PNB TA Bill Format
UPSEE Medical Certificate Format
Rw Format
Format of AIPMT
AMIETE Certificate Format
TOEFL Listening Format
kcet format
crpf obc certificate format
anna university ppt format
ugc net obc certificate format
jee format
MBA IT resume format
MBA Personal Statement Format
O.U MBA Project Format


Quick Reply
Your Username: Click here to log in

Message:
Options



All times are GMT +5.5. The time now is 03:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.1
vBulletin Optimisation provided by vB Optimise (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.