PHP код:
stock GetMinute()
{
new Hour,Minute,Second;
gettime(Hour,Minute,Second);
return Minute;
}
stock GetDay()
{
new Year,Month,Day;
getdate(Year, Month, Day);
return Day;
}
stock GetMonth()
{
new Year,Month,Day;
getdate(Year, Month, Day);
return Month;
}
stock GetYear()
{
new Year,Month,Day;
getdate(Year, Month, Day);
return Year;
}
stock GetSecond()
{
new Hour,Minute,Second;
gettime(Hour,Minute,Second);
return Second;
}
stock GetHour()
{
new Hour,Minute,Second;
gettime(Hour,Minute,Second);
return Hour;
}
stock IsLeapYear(year)
{
switch(year)
{
case 2012: return 1;
case 2016: return 1;
case 2020: return 1;
case 2024: return 1;
case 2028: return 1;
case 2032: return 1;
case 2036: return 1;
}
return 0;
}
stock GetDaysInMonth(month)
{
new Year,Month,Day,days;
getdate(Year, Month, Day);
switch(month)
{
case 1: days = 31;
case 2:
{
if(IsLeapYear(Year)) days = 29;
else days = 28;
}
case 3: days = 31;
case 4: days = 30;
case 5: days = 31;
case 6: days = 30;
case 7: days = 31;
case 8: days = 31;
case 9: days = 30;
case 10: days = 31;
case 11: days = 30;
case 12: days = 31;
}
return days;
}