We are using the following js lib from Microsoft https://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js
var datetimehigh = new Date(2011,01,12,14,45,55,596);
var sDate = datetimehigh.format("dd/MM/yyyy HH:mm:ss sss");
I cannot get the millisecond part to work.Note that format comes from Microsoft's Mvc Ajax lib.
getUTCMilliseconds() returns the milliseconds (0 to 999) of a date. getUTCMilliseconds() returns the milliseconds according to UTC.
Use the Date() constructor to convert milliseconds to a date, e.g. const date = new Date(timestamp) . The Date() constructor takes an integer value that represents the number of milliseconds since January 1, 1970, 00:00:00 UTC and returns a Date object.
const d = new Date("2015/03/25"); The behavior of "DD-MM-YYYY" is also undefined. Some browsers will try to guess the format. Some will return NaN.
Usually we display time in in 12 hour format hh:mm:aa format (e.g. 12:30 PM) or 24 hour format HH:mm (e.g. 13:30), however sometimes we also want to show the milliseconds in the time. To show the milliseconds in the time we include “SSS” in the pattern which displays the Milliseconds.
If you are using the native Date
javascript object, you can simply use .toISOString
method to get a formatted string with milliseconds:
const date = new Date();
const dateString = date.toISOString(); // "2020-01-06T19:57:12.146Z"
Note that using .toString
won't give you milliseconds precision.
It's indicated by an f:
"dd/MM/yyyy HH:mm:ss fff"
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