Talk:Date manipulation: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 19: | Line 19: | ||
: The task itself does not specify what the answer should be -- only the answers may/will be region specific. The result of the Tcl solution merely happens to show that I live in the Eastern time zone. --[[User:Glennj|glennj]] 10:36, 14 May 2009 (UTC) |
: The task itself does not specify what the answer should be -- only the answers may/will be region specific. The result of the Tcl solution merely happens to show that I live in the Eastern time zone. --[[User:Glennj|glennj]] 10:36, 14 May 2009 (UTC) |
||
:: You can always use the <tt>-timezone</tt> option to print in another format. |
|||
::<lang tcl>% set date "March 7 2009 7:30pm EST" |
|||
March 7 2009 7:30pm EST |
|||
% set epoch [clock scan $date -format "%B %d %Y %I:%M%p %z"] |
|||
1236472200 |
|||
% set later [clock add $epoch 12 hours] |
|||
1236515400 |
|||
% clock format $later |
|||
Sun Mar 08 12:30:00 GMT 2009 |
|||
% clock format $later -timezone America/New_York |
|||
Sun Mar 08 08:30:00 EDT 2009 |
|||
% clock format $epoch |
|||
Sun Mar 08 00:30:00 GMT 2009</lang> |
|||
::The last one is just to check that it really is doing the time math right. Forgot that there was a DST change at that point in time... —[[User:Dkf|Dkf]] 10:58, 14 May 2009 (UTC) |