Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Millisecond formatter do not work properly #107

Open
GianlucaVagnoni opened this issue Mar 5, 2018 · 2 comments
Open

Millisecond formatter do not work properly #107

GianlucaVagnoni opened this issue Mar 5, 2018 · 2 comments

Comments

@GianlucaVagnoni
Copy link

If I use a formatter like this "yyyy-MM-dd HH:mm:ss.SSS" the milliseconds section (SSS) is not properly formatted.
Example:

var outputDatestring = "2015-03-25T13:43:00.123+0000";
var date = new Date(outputDatestring);
console.log($.format.date(date, "yyyy-MM-dd HH:mm:ss.SSS"));

This code logs the following result (my browser is in GTM+01:00, so the hour is correct, but not the milliseconds section):
2015-03-25 14:43:00. Eu

Expected result:
2015-03-25 14:43:00.123

@phstc phstc closed this as completed Aug 7, 2018
@phstc
Copy link
Owner

phstc commented Aug 7, 2018

Hi @GianlucaVagnoni

Unfortunately, your input format does not seem to be in the expected input list.

From where is that format coming from?

@phstc phstc reopened this Aug 7, 2018
@ghost
Copy link

ghost commented Mar 25, 2020

Hi,
That format is called ISO 8601, which is one of the most common formats used for serialization/deserialization of Date objects as a string in JSON format.

There is also another common ISO 8601 format:
"2015-03-25T13:43:00.123Z"

...which is what javascript outputs with toISOString()

new Date().toISOString()
"2020-03-25T19:21:42.398Z"

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants