Date/Time Variables

int sysdate.year;
int sysdate.month;
int sysdate.day;
int sysdate.dayofweek; 

int systime.hour;
int systime.minute;
int systime.second;

sysdate.year - The year according to the system clock.

sysdate.month - The month according to the system clock.

sysdate.day - The day according to the system clock.

sysdate.dayofweek - The day of the week according to the system clock (0 = Sunday, 1 = Monday, ...6 = Saturday).

systime.hour - The hour in military time according to the system clock.

systime.minute - The minute according to the system clock.

systime.second - The second according to the system clock.

Talkback

Post a new comment?

Talkback #1 written by Interference22 on 2004-07-08.

If - like me - you like your time displayed in 12-hour format rather than 24 (the way your computer handles the time) then the following code may be of use to you: it returns a string containing the time in 12-hour format.

// Returns the time in 12 hour format (with am/pm) as a string
string 12HourTime()
{
int hour;
string ampm, min, sec, thetime;

if (systime.hour >= 12)
{
hour = systime.hour - 12;
ampm = "pm";
}

else {
hour = systime.hour;
ampm = "am";
}

if (systime.minute < 10) { min = "0"+str(systime.minute);}
else { min = str(systime.minute); }

if (systime.second < 10) { sec = "0"+str(systime.second);}
else { sec = str(systime.second); }

thetime = str(hour)+":"+min+":"+sec+" "+ampm;

return thetime;
}

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.