Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date.format
Message
De
10/03/2015 15:06:17
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Divers
Thread ID:
01616602
Message ID:
01616605
Vues:
33
This message has been marked as the solution to the initial question of the thread.
>Hi everybody,
>
>According to this page https://docs.angularjs.org/api/ng/filter/date the milliseconds are supposed to be .sss in the format string.
>
>I'm trying the following code:
>
>
>var format = function (date) {
>                        if (date) {
>                            if (!pickTime) {
>                                if (isEndDate && !onlyFutureDates) {
>                                    date = date.hours(23).minutes(59).seconds(59).milliseconds(997);
>                                    date = date.format("YYYY-MM-DDTHH:mm:ss.sss").toString();
>                                } else {
>                                    date = date.hours(0).minutes(0).seconds(0).milliseconds(0);
>                                    date = date.format("YYYY-MM-DDTHH:mm:ss").toString();
>                                }
>                            }                            
>                        }
>                        return date;
>                    };
>
>and I've been tracing it in Visual Studio immediate window and I can see that it returns seconds after seconds instead of milliseconds. In other words, my date ends by 997 but I am seeing 595 instead.
>
>I am wondering what should I use here instead in order to see correctly formatted date with milliseconds?
>
>Thanks a lot in advance.

I don't think you can use the 's' variants twice. Either 'ss' for seconds or 'sss' for milliseconds.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform