in reply to Converting local time to UTC mystery

And what is it that you did you expect?

$ perl -MHTTP::Date -le " print for ~~localtime, ~~gmtime, str2time(q/ +20110905 142631/) " Mon Sep 5 06:25:26 2011 Mon Sep 5 13:25:26 2011 1315257991 $ perl -MHTTP::Date -le " $f = str2time(q/20110905 142631/) ; print fo +r ~~localtime $f, ~~gmtime $f" Mon Sep 5 14:26:31 2011 Mon Sep 5 21:26:31 2011
As HTTP::Date promises, when timezone isn't specified, the distance from epoch str2time gives, fed to localtime, produces the original date supplied

Replies are listed 'Best First'.
Re^2: Converting local time to UTC mystery
by rovf (Priest) on Sep 05, 2011 at 13:35 UTC
    As HTTP::Date promises, when timezone isn't specified, the distance from epoch str2time gives, fed to localtime, produces the original date supplied
    Exactly, and my understanding (and here I probably was wrong) was, that I can supply the optional second parameter to str2time, saying that I don't want to have the result in localtime, but in a different timezone (in my case, 'UTC'). Since this is obviously not the case, what then is the purpose of the second argument to str2time?

    Could you please give me an example, how to call str2time, so that I get the result in UTC?

    -- 
    Ronald Fischer <ynnor@mm.st>