SA-MP Forums Archive
IsDateAndTimeInThePast - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsDateAndTimeInThePast (/showthread.php?tid=112651)



IsDateAndTimeInThePast - Calon - 09.12.2009

I really extremely terribly suck with mathematics, is there any chance somebody could help me create a function to check if a date is in the past, the function looking something like:

IsDateAndTimeInThePast(day, month, year, minute, hour, second);


Re: IsDateAndTimeInThePast - Double-O-Seven - 09.12.2009

Just count the second of the year^^

pawn Код:
new MonthDays[12]=
{
    31,//Januar
    28,//Februar
    31,//Maerz
    30,//April
    31,//Mai
    30,//Juni
    31,//Juli
    31,//August
    30,//September
    31,//Oktober
    30,//November
    31//Dezember
};

stock GetYearSecond()
{
    new d,m,y,h,s,ys;
    gettime(h,m,s);
    ys=s;
    ys+=m*60;
    ys+=h*60*60;
   
    getdate(y,m,d);
    ys+=(d-1)*24*60*60;
    for(new i=0;i<(m-1);i++)
      ys+=MonthDays[i]*24*60*60;
    return ys;
}