Forum Discussion
Joe_D_Rozario_4
Nimbostratus
Mar 27, 2008date format conversion
I need some help with date-time conversion. Our servers are setting cookies with local time-stamp i.e., Thu, 09 Apr 2008 17:06:48 PDT (or PST). I am trying to find a way to convert this time-stamp to GMT i.e., Thu, 10 Apr 2008 00:06:48 PDT.
I have tried code like this:
set cookie_expires [HTTP::cookie "Expires"]
set x [clock scan $cookie_expires -format {%a, %d %b %Y %T %Z}]]
set y [clock format $x -format {%a, %d %b %Y %T %Z} -timezone :UTC]
The errors are:
[wrong args] on [clock scan]
[invalid switch] with [clock format]
Thank for your help.
2 Replies
- hoolio
Cirrostratus
Per the man page for clock (Click here), I don't think -format is a valid flag for clock scan. And -timezone doesn't seem to be valid for clock format. Can you give this a shot?when RULE_INIT { set ::date_str_orig {Thu, 09 Apr 2008 17:06:48 PDT} set x [clock scan $::date_str_orig] set y [clock format $::x -format {%a, %d %b %Y %T %Z} -gmt 1] log local0. "\$::date_str_orig: $::date_str_orig, \$::x: $::x, \$::y: $::y" }
Log output:Rule : $date_str_orig: Thu, 09 Apr 2008 17:06:48 PDT, $x: 1207786008, $y: Thu, 10 Apr 2008 00:06:48 GMT
Aaron - Joe_D_Rozario_4
Nimbostratus
That works! Thanks Aaron.
I looked up the documentation on clock in http://tmml.sourceforge.net/doc/tcl/clock.htmlSECTid8216120
But the link for man page you provided has more accurate information.
Thanks again for your help.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects