Re: Time Question

Discussion in 'Perl Misc' started by Wolf Behrenhoff, Aug 1, 2012.

  1. Am 01.08.2012 18:16, schrieb E.D.G.:
    > TIME QUESTION
    >
    > The goal is to be able to tell what the UTC date and time are (ex.
    > 2012/08/01 12:34:56) that is say 130 days and 4 hours ahead of some date
    > such as today or 30 days from now.


    perldoc Date::Calc

    - Wolf
     
    Wolf Behrenhoff, Aug 1, 2012
    #1
    1. Advertising

  2. Wolf Behrenhoff

    HASM Guest

    Wolf Behrenhoff <> writes:

    >> The goal is to be able to tell what the UTC date and time are (ex.
    >> 2012/08/01 12:34:56) that is say 130 days and 4 hours ahead of some date
    >> such as today or 30 days from now.


    > perldoc Date::Calc


    or Date::Manip

    -- HASM
     
    HASM, Aug 3, 2012
    #2
    1. Advertising

  3. Wolf Behrenhoff

    charley% Guest

    On Friday, August 3, 2012 7:50:45 AM UTC-4, E.D.G. wrote:
    > "Ben Morrow" <ben<at>morrow.me.uk> wrote in message
    >
    > news:1hdoe9-u151.ln1<at>anubis.morrow.me.uk...
    >
    > >

    >
    > > IMHO it's better to just go with DateTime.

    >
    >
    >
    > Thanks for the information.
    >
    >
    >
    > I myself just created two Perl subroutines from some True Basic code
    >
    > that will also do this. The first translates dates into a single number
    >
    > that can be added to other numbers that have that format. And the final
    >
    > number can then be decoded back to year and month etc. by the second
    >
    > subroutine. Together they represent about 50 lines of code.
    >
    >
    >
    > I am planning to try to post that code to this Newsgroup after the
    >
    > subroutines have been running for a while and they look like they are not
    >
    > making any mistakes. However, I learned how to program years ago using
    >
    > Fortran and Basic. So, the code will probably not look very attractive to
    >
    > Perl programmers. People can make any adjustments they wish to the code
    >
    > before using it.
    >
    >
    >
    > However, if those Perl routines people mentioned are easier to use
    >
    > then I am planning to use them instead for my own applications.


    Here is a snippit using DateTime

    use DateTime;

    my $now = DateTime->now;
    my $future = $now->clone->add(days => 130, hours => 4);
    print $now, "\n";
    print $future, "\n";

    Chris
     
    charley%, Aug 3, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. engsol
    Replies:
    2
    Views:
    971
    Dan Bishop
    Jan 26, 2004
  2. Replies:
    8
    Views:
    491
    Magnus Lycka
    Aug 5, 2005
  3. Peter Hansen
    Replies:
    0
    Views:
    724
    Peter Hansen
    Feb 22, 2006
  4. Peter Hansen
    Replies:
    0
    Views:
    615
    Peter Hansen
    Feb 22, 2006
  5. flamesrock
    Replies:
    8
    Views:
    509
    Hendrik van Rooyen
    Nov 24, 2006
Loading...

Share This Page