Linked Questions
705 questions linked to/from How do I format a date in JavaScript?
125
votes
12
answers
523k
views
Function to convert timestamp to human date in javascript [duplicate]
How to convert this timestamp 1382086394000 to 2013年10月18日 08:53:14 using a function in javascript? Currently I have this function:
function cleanDate(d) {return new Date(+d.replace(/\/Date\((\d+)\)\//...
28
votes
8
answers
84k
views
Javascript get date in format [duplicate]
I want to get today's date in the format of mm-dd-yyyy
I am using var currentDate = new Date();
document.write(currentDate);
I can't figure out how to format it.
I saw the examples var currentTime =...
11
votes
5
answers
8k
views
How can I format an ISO 8601 date to a more readable format, using Javascript? [duplicate]
I'm using an API to call a date from a post.
Dates are returned in ISO 8601 format :
2015年11月09日T10:46:15.097Z
I want my dates to be formatted like this :
09/11/2015
Then, later, I want to insert ...
5
votes
3
answers
33k
views
How to format date in javascript as DD-MMM-YYYY? [duplicate]
So the backend serves date to FE as: '2019-05-30T00:00:00.000Z'
I am trying render on FE as 30-May-2019
So...
let date = new Date( Date.parse('2012-01-26T13:51:50.417-07:00') );
I have been trying to ...
0
votes
1
answer
19k
views
How can remove time from Date string [duplicate]
var x = new Date();
myVar = x.toString();
document.write(myVar);
// Sat Feb 14 2015 14:20:58 GMT+0100 (CET)
I want to remove the time <<14:20:58 GMT+0100 (CET)>>
6
votes
2
answers
8k
views
Format Date to long format [duplicate]
I am working in javascript and am trying to format a date that I am receiving in this format 2017年07月31日 to this format July 31, 2017.
Is there a best practice on accomplishing this?
2
votes
3
answers
19k
views
How to convert yyyy-mm-dd't'hh:mm:ssZ to normal time javascript? [duplicate]
I have an SDK which returns the time in yyyy-mm-dd't'hh:mm:ssZ this format, but I just want the Day, Month and Time.
I searched it over and didn't found an exact solution to my problem. Can anyone ...
2
votes
4
answers
35k
views
javascript date format yyyy-mm-dd HH:MM:ss [duplicate]
I have facing an issue in javascript date format all dates in this format yyyy-mm-dd HH:MM:ss
My Code:
var currentdate = new Date();
var prevdate = new Date();
var firstdate = new Date();
prevdate....
1
vote
4
answers
7k
views
How can I add one hour to a datetime-local with javascript [duplicate]
I have this input <input type="datetime-local" id="myTime" /> in my HTML code. I am using javascript to take the value of this input var myTime = document.getElementById("myTime").value; but I ...
4
votes
1
answer
9k
views
Get Current Date/Time with JavaScript [duplicate]
I need to get the current date and time javascript in the following format
YYYY-MM-DD HH:MM:SS
But cannot work out how to do it.
var d = new Date();
timesheetGrid.cellById(rId,15).setValue(d);
...
1
vote
1
answer
19k
views
How can I get a (MM-DD-YYYY) format from a UTC string in javascript? [duplicate]
I am working with a Date object in a different timezone than the console. I'm using utc string to get the actual time that was logged in that timezone. Is there an easy way to extract the (MM-DD-YYYY) ...
-2
votes
3
answers
4k
views
Print JavaScript date in 'MMM dd, yyyy' format (like 'Oct 17, 2012') [duplicate]
I am getting a date string in ISO format (for example, '2012-10-16T17:57:28.556094Z'), but while printing it in my html page I should print it in 'MMM dd, yyyy' format (for example, 'Oct 17, 2012').
...
1
vote
3
answers
4k
views
How to change the format of a date in JavaScript? [duplicate]
I have a date formatted as 2018年06月13日T13:28:14+0000, and I want to change it into this format 13/6/2018 1:28:14 PM.
Any suggestions will be helpful.
Thanks, in advance :)
6
votes
3
answers
1k
views
Convert the timestamp into ("MMM DD, HH:mm") format. JS [duplicate]
I have a date returned as a timestamp from the the server response and I want to convert it to ("MMM DD, HH:mm") format using the toUTCString(). so far I have this:
date = new Date(1555649122787)....
2
votes
1
answer
8k
views
How to remove the time in Date() Jquery? [duplicate]
Hi I have a code like this.
var date = new Date(), y = date.getFullYear(), m = date.getMonth();
var firstDay = new Date(y, m, 1);
The result is like this:
"Thu Sep 01 2016 00:00:00 GMT+0800 (China ...