22.11.2010, 06:07
Well I'm creating this simple time + date script, it works as it should, BUT, i would like to format the date for example, if the 'Hour' is less than 9 , it will show: 09, then 10... That also goes if the 'Hour' AND 'Minute' AND 'Hour' are less than 9, it will print like this: '02:15:02' < Hour, minute, second
That's what i got, i been testing it for a while, can't get the correct calculations :P
pawn Код:
new Hour, Minute, Sec, Day, Month, Year, String[50];
gettime(Hour, Minute, Sec); getdate(Year, Month, Day);
if(Hour <= 9 && Sec <= 9)
{
format(String, sizeof(String), " 0%d:%d:0%d~n~%s.%d.%d", Hour, Minute, Sec, GetMonth(), Day, Year);
}
else if(Hour <= 9 && Minute <= 9)
{
format(String, sizeof(String), " 0%d:0%d:%d~n~%s.%d.%d", Hour, Minute, Sec, GetMonth(), Day, Year);
}
else if(Minute <= 9)
{
format(String, sizeof(String), " %d:0%d:%d~n~%s.%d.%d", Hour, Minute, Sec, GetMonth(), Day, Year);
}
else format(String, sizeof(String), " %d:%d:%d~n~%s.%d.%d", Hour, Minute, Sec, GetMonth(), Day, Year);
TextDrawSetString(PlayerTime, String);
printf("%s", String);