Skip to content
Advertisement

Tag: type-conversion

Convert timestamp to “YY/MM/DD” with JS

I need to convert my “80814.89999999851” timestamp to a YY/MM/DD string. I started by doing this: var prova = info.originalEvent.timeStamp; //this path lead to: 80814.89999999851 var prova2 = new Date(prova); Now I have it as a datetime (if i’m not mistaken) but i don’t know how to keep just the year/month/day and then convert it to a string. Can someone

Convert string to datetime

How to convert string like ’01-01-1970 00:03:44′ to datetime? Answer For this format (assuming datepart has the format dd-mm-yyyy) in plain javascript use dateString2Date. It may bite you, because of browser compatibility problems. tryParseDateFromString is ES6 utility method to parse a date string using a format string parameter (format) to inform the method about the position of date/month/year in the

Advertisement