Quantcast
Channel: Spiceworks Community - Latest topics
Viewing all articles
Browse latest Browse all 183425

How do I compare dates (earlier, later, difference in days)?

$
0
0
Hi,
I have a form in which I have the users enter two date fields (via the little calendar icon).  I want to compare these two dates and if one is earlier than another, send an email A, otherwise send email B.  The thing is, when I do...:
if (input.date1 < input.date2) { sendemail(); }
...it doesn't quite work in all cases.  For example, if date2 is 12/21/2012 and date1 is 1/10/2013, it'll say that date1 < date2, when actually date2 is earlier than date1.  How do I compare dates and find their relationship relative to one another?
In addition, how do I find the number of dates between two dates?  (e.g. 1/20/2013 and 2/12/2013)
Do the Date fields have built-in functions that allow me to do this?
Thank you for your help!

Read More

Viewing all articles
Browse latest Browse all 183425

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>