# Timestamp Issue

**URL:** <https://forum.kirupa.com/t/timestamp-issue/321600>\
**Category:** Uncategorized\
**Created:** [April 25, 2011, 2:50pm UTC](https://forum.kirupa.com/t/timestamp-issue/321600 "2011-04-25T14:50:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thevezs](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@thevezs](https://forum.kirupa.com/u/thevezs)\
**Post date:** [April 25, 2011, 2:50pm UTC](https://forum.kirupa.com/t/timestamp-issue/321600/1 "2011-04-25T14:50:48Z")

</div>

I’ve been using this code off and on for months now and suddenly having issues with this code:

function compareDates (date1 : Date, date2 : Date) : Number  
{  
var date1Timestamp : Number = date1.getTime ();  
var date2Timestamp : Number = date2.getTime ();

```
var result : Number = -1;

if (date1Timestamp == date2Timestamp)
{
    result = 0;
}
else if (date1Timestamp &gt; date2Timestamp)
{
    result = 1;
}

return result;

```

}

dateBefore.visible = compareDates(new Date(), new Date(2011, 04, 19)) \<= 0; //NB: Months are 0-based.  
dateAfter.visible = !dateBefore.visible;

If I change the date to (2011, 01, 19) it works fine, but with the date needed it will not work. I double checked my system preferences and they are fine.

Any suggestions would be greatly appreciated.

Thx,

S
