It's all about the answers!

Ask a question

Build Forge Date timezone format issue

Leo Hui (1522) | asked Apr 15 '13, 10:47 p.m.
My location is in Sydney Australia and I have set the timezone to "GMT+10:00" instead of "Australian Eastern Standard Time". However when I used .date command .date %Y-%m-%d %H:%M:%S %Z, it will return my timezone as whole name instead of GMT+10:00 like this:

2013-04-16 11:48:12 AUS Eastern Standard Time

I realized rbf's .date is based on POSIX strftime() function, %Z is the name or abbreviation of time zone and %z (lowercase) is the numeric representation of timezone. However rbf does not have %z available.

is there a way to return the timezone as numbers as I am doing further processing with the returned time.

Accepted answer

permanent link
Robert haig (1.0k16) | answered Apr 16 '13, 11:17 a.m.
 The code filters based on allowed parameters (as I'm sure you've found, we will ignore %z).  As such, using .date, there isn't a way to do what you want to do.  You would have to make an external shell call to parse your timezone based on the TZ in that shell.  

This is a reasonable request, and one that is simple enough to implement.  I would suggest making an RFE submission to get the %z parameter supported by .date

Leo Hui selected this answer as the correct answer

Your answer

Register or to post your answer.