boneyard_11131
Nov 24, 2016Nimbostratus
crafting a RFC1123 timestamp for Date header in an iRule
for crafting a HTTP response i the need a timestamp in RFC 1123 format for the Date header.
example: Thu, 24 Nov 2016 19:34:09 GMT
i was able to get most of it within a clock format line
set rfc1123_time [clock format [clock seconds] -format "%a, %d %b %Y %H:%M:%S %Z"]
but the timezone should be in GMT, with adding -gmt 0 (not -timestamp as i found in some documentation) it changes the time correctly but the time zone from %Z becomes UTC and not GMT
set rfc1123_time [clock format [clock seconds] -gmt 0 -format "%a, %d %b %Y %H:%M:%S %Z"]
for now i went the easy way, dropped the timezone part from the clock format and added GMT in text.
any iRule wizards know how to do this more nicely? so one clock format that returns the requested string.