// Henjin Date/Time Demo // (c) 2008, Notequalsoft Games // http://www.notequalsoft.com/games/henjin/ // This demo demonstrates the functions that display the current system date and time. // setup system System.Size 640 480 System.Continue true System.CreateTextBox TextBox 0 0 640 480 TextBox.DisplayAtOnce true System.CreateImage WaitImage 619 460 18 17 "waiting.gif" System.WaitImage WaitImage label START // get local time setlocalyear year setlocalday day setlocalmonth month goto RESOLVEMONTH setlocaldayofweek dayofweek goto RESOLVEDAYOFWEEK setlocalhours hour if hour < 12 set ampm = 'AM' if hour = 0 set hour = 12 endif else set hour - 12 set ampm = 'PM' endif setlocalminutes min setpadleft min min 2 "0" setlocalseconds sec setpadleft sec sec 2 "0" setlocalmilliseconds ms setpadleft ms ms 3 "0" TextBox.Text "{dayofweek}, {month} {day}, {year} {hour}:{min}:{sec}.{ms} {ampm} (Local)\n" setuniversalyear year setuniversalday day setuniversalmonth month goto RESOLVEMONTH setuniversaldayofweek dayofweek goto RESOLVEDAYOFWEEK setuniversalhours hour setpadleft hour hour 2 "0" setuniversalminutes min setpadleft min min 2 "0" setuniversalseconds sec setpadleft sec sec 2 "0" setuniversalmilliseconds ms setpadleft ms ms 3 "0" TextBox.AddText "{dayofweek}, {month} {day}, {year} {hour}:{min}:{sec}.{ms} GMT" react // repeat demo goto START // subfunction to get the name of the month label RESOLVEMONTH if month = 1 set month = "January" elseif month = 2 set month = "February" elseif month = 3 set month = "March" elseif month = 4 set month = "April" elseif month = 5 set month = "May" elseif month = 6 set month = "June" elseif month = 7 set month = "July" elseif month = 8 set month = "August" elseif month = 9 set month = "September" elseif month = 10 set month = "October" elseif month = 11 set month = "November" else set month = "December" endif return // subfunction to get the name of the day of week label RESOLVEDAYOFWEEK if dayofweek = 1 set dayofweek = "Sunday" elseif dayofweek = 2 set dayofweek = "Monday" elseif dayofweek = 3 set dayofweek = "Tuesday" elseif dayofweek = 4 set dayofweek = "Wednesday" elseif dayofweek = 5 set dayofweek = "Thursday" elseif dayofweek = 6 set dayofweek = "Friday" else set dayofweek = "Saturday" endif return