Hi All,
I found some strange behavior with the below expressions related to date and time.
{ /* All these worked */ now() + second() * 62, now() + minute() * 5, now() + hour() * 5, now() + day() * 5, /* These didn't work */ now() + month() * 5, now() + year() * 5 }
Can someone please explain why the last 2 statements don't work, and throw cast invalid error?
Discussion posts and replies are publicly visible
Second, minute, hour, and day function returns the value in the interval 'day to second' whereas month and year return the value in the interval 'year to month'. But date time allows to add/subtract in days only (now()+6-now()).
{now() + second() * 62, now() + minute() * 5, now() + hour() * 5, now() + day() * 5,
/* Try alternate by adding no of days i[ find leap year or not before add a years ]*/now()+30 /add 30 or 31, 29 based on months*/,now()+365}