Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing two datetime strings
Message
De
07/02/2018 07:25:31
 
 
Information générale
Forum:
Javascript
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01657934
Message ID:
01657956
Vues:
33
OP question was not really targeted at this answer - "02/05/2018" is clearly a different string compared to "05.02.2018" but both strings should point to the same date ;-)


>>moment.js should be able to cope with these
>>
>>>This should be an easy question. I have two datetime strings like "02/05/2018 12:00" and "02/18/2018 14:41". I want to compare date portions of these strings to find if they are the same or different.
>>>How can I do it?
>
>I used this code which seems to work:
>
>
>let newDate = new Date(new Date(val).toDateString());
>                                let originalDate = new Date(new Date(modelValue).toDateString());
>                                if (newDate.valueOf() !== originalDate.valueOf()) {
>
>based on suggestion in StackOverflow.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform