Hello kepler,

You have already 83 Writeups on this forum so I think you know what is a Short, Self Contained, Correct (Compilable), Example that fellow monk stevieb is asking you for.

Just to clarify in case that still is not clear why we all monks asking for that. If you need our assistance, you have to show the minimum effort and create a small script executable that replicates your problem. By doing this you can help us to help you.

Moving on, are you looking for something like this?

#!usr/bin/perl use say; use strict; use warnings; use DateTime; use DateTime::TimeZone; sub TimeZone { my ($dt) = @_; my $tz = $dt->time_zone(); my $offset = $tz->offset_for_datetime($dt); return $offset; } my $dt = DateTime->new( year => 1964, month => 10, day => 16, hour => 16, minute => 12, second => 47, nanosecond => 500000000, time_zone => 'Asia/Taipei', ); my $tz = DateTime::TimeZone->new( name => 'America/Chicago' ); my $offset = $tz->offset_for_datetime($dt); say TimeZone($dt); say $offset; __END__ $ perl test.pl 28800 -18000

I used the default parameters as give in DateTime.

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re: Date Timezone by thanos1983
in thread Date Timezone by kepler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.