Date manipulation
Date manipulation
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Given the date string "March 7 2009 7:30pm EST", output the time 12 hours later in any human-readable format.
Tcl
<lang tcl>set date "March 7 2009 7:30pm EST" set epoch [clock scan $date -format "%B %d %Y %I:%M%p %z"] set later [clock add $epoch 12 hours] puts [clock format $later] ;# Sun Mar 08 08:30:00 EDT 2009</lang>
Note the transition into daylight savings time in the interval (in the Eastern timezone).