This question already has answers here:
Convert UTC date time to local date time
(38 answers)
Closed 9 years ago.
Lets say my server is in one country, and the client is in another, date like:
2014/12/24 12:00:00
how to convert it to the client-browser time?
new Date('2014/12/24 12:00:00').toLocaleString();
Source: http://www.w3schools.com/jsref/jsref_tolocalestring.asp
Related
This question already has answers here:
How do I format a date in JavaScript?
(68 answers)
Closed 2 years ago.
I want to convert the JavaScript date object
let date = Date.now();
to date in RFC 3339 format, so it would return like this:
2020-05-21T08:01:48+00:00
How can I convert it? Get Help! Thank you!~
Try toISOString.
new Date('2020-05-21 08:01:48').toISOString()
This question already has answers here:
change date format in javascript
(3 answers)
Format date to MM/dd/yyyy in JavaScript [duplicate]
(3 answers)
How to convert string to Date object?
(3 answers)
How do I format a date in JavaScript?
(68 answers)
Closed 4 years ago.
I know there are many functions in javascript that changes the date format, but I want to change the format of the string.
How can I change
2018-05-10T21:12:08Z
to
2018-05-10 9:12:08 AM
The date function doesn't work since it's not a date type.
You can use moment library to do all kind of date/time operations.
var dt = moment('2018-05-10T21:12:08Z');
console.log(dt.format('YYYY-MM-DD h:mm:ss A'));
This question already has answers here:
Proper Way to Convert JSON Date to .NET DateTime During Deserialization
(6 answers)
Closed 5 years ago.
I have a date like this var jsDate = "2017-01-01";
I want to put this jsDate like C# date: (/Date(1425408717000)/)
Also how can put this c# date /Date(1425408717000)/ into JavaScript Json date?
In JavaScript you can try: (new Date("2017-01-01")).getTime() , which will give you 1483228800000 if that's what you are looking for
This question already has answers here:
How do I get a UTC Timestamp in JavaScript?
(16 answers)
Closed 7 years ago.
For example if you receive a timestamp in Javascript:
1433454951000
How would you create a function to convert the timestamp into UTC like:
2015/6/4 GMT+7
var d1 = new Date("UNIX TIME STAMP HERE");
d1.toUTCString()
Originally asked here:
How do I get a UTC Timestamp in JavaScript?
This question already has answers here:
How to convert milliseconds into a readable date?
(7 answers)
Closed 9 years ago.
can I convert milliseconds to date and time string. suppose I have millisecond in a long number and I want it like this:
Oct 22 2013 09:50:17
is this possible??
Like this:
var date = new Date(1324339212260);
date.toString("MMM dd");