in reply to Print time in Date"T"time+Gmtoffset

Is the colon required in the offset for your purposes? If not:

perl -E ' use POSIX; say strftime "%Y-%m-%dT%H:%M:%S%z", localtime(); ' 2014-03-31T23:37:59-0700

If you want the colon and no zero-padding, you could grab the offset by itself (strftime "%z", localtime();), throw a colon in it and drop the leftmost digit if it is 0. Or there might be an easier way.

Replies are listed 'Best First'.
Re^2: Print time in Date"T"time+Gmtoffset
by ikegami (Patriarch) on Apr 01, 2014 at 14:17 UTC
    Allowing the leading zero to be dropped would be a bad choice of format as it would no longer be an iso8601 timestamp. (Adding a colon is fine.)
Re^2: Print time in Date"T"time+Gmtoffset
by techman2006 (Beadle) on Apr 01, 2014 at 07:00 UTC

    Thanks but I need a colon in timezone as need to put it in a xml file which understand that notation only.

      then do it in two steps :) second step being adding colon to timezone