i have a json file that returns "date_created":"1273185387"
in epoch format
i want to convert it to something like this Thu, 06 May 2010 22:36:27 GMT
any script to do this conversion?
var dt = new Date(obj. date_created * 1000);
Select the cells that have the number that you want to convert into a date. Click the 'Home' tab. In the 'Number' group, click on the Number Formatting drop-down. In the drop-down, select 'Long Date' or Short Date' option (based on what format would you want these numbers to be in)
Use the Date() constructor to convert a string to a Date object in TypeScript, e.g. const date = new Date('2024-07-21') . The Date() constructor takes a valid date string as a parameter and returns a Date object.
var myObj = $.parseJSON('{"date_created":"1273185387"}'), myDate = new Date(1000*myObj.date_created); console.log(myDate.toString()); console.log(myDate.toLocaleString()); console.log(myDate.toUTCString());
http://jsfiddle.net/mattball/8gvkk/
alert(new Date(1273185387).toUTCString());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With