Compare only time in Date - javascript -


this question has answer here:

how can compare time in js? let's have 2 dates :

date1 = tue apr 11 2017 12:30:00 date2 = tue apr 7 2017 02:30:00 

and want make if statement

if(time of day in date1 after time of day in date2) {     // } 

how can achieve in clean , nice way?

if can use 3rd party libraries, have @ moment library. has isbefore , isafter methods should want.

if can't use 3rd party libraries, can use gethours(), getminutes(), , getseconds() properties on date object.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -