compare two dates in javascript yyyy mm dd

Solutions on MaxInterview for compare two dates in javascript yyyy mm dd by the best coders in the world

showing results for - "compare two dates in javascript yyyy mm dd"
Alessandra
06 Jun 2020
1// Shows if one date is gerater than the other returns True/False.
2var date1 = '2015-08-20 09:38:20';
3var date2 = '2015-08-20 08:00:00';
4var date1Updated = new Date(date1.replace(/-/g,'/'));  
5var date2Updated = new Date(date2.replace(/-/g,'/'));
6console.log(date1Updated > date2Updated);