10.09.2016, 14:50
Hi,
It's possible to check if certain date is passed or no?
It's possible to check if certain date is passed or no?
new d,m,y, h,mi,s;
getdate(y,m,d),gettime(h,mi,s);
if(y >= 2016 && m >= 9 && d >= 11 && h >= 15 && mi >= 30)
{
//Here its the 11.09.2016 after 15:30
}
else
{
//Here its before
}
sscanf(date_time, "p</>iiip<:>iiI(0)", year, month, day, hour, mins, sec);
mktime(const mdate_mtime[], utcdiff = 0)
{
new year, month, day, hour, mins, sec, tyears, tdays, leaps, utc_hrs;
static const mon_days[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304};
sscanf(mdate_mtime, "p</>iiip<:>iiI(0)", year, month, day, hour, mins, sec);
month--;
year -= 1900;
tyears = year - 70;
leaps = (tyears + 2) / 4;
tdays = mon_days[month];
tdays += day - 1;
tdays = tdays + (tyears * 365) + leaps;
utc_hrs = hour + utcdiff;
return (tdays * 86400) + (utc_hrs * 3600) + (mins * 60) + sec;
}
if (mktime(datetime_specified_by_user, -GMT) > gettime()) return ...
// ... return error that this date has yet to come