Loading ...
Sorry, an error occurred while loading the content.

perl query

Expand Messages
  • srikanth_kovur
    In perl, how to find date after 5 days, if they have given todays date.
    Message 1 of 3 , Mar 16, 2008
    • 0 Attachment
      In perl, how to find date after 5 days, if they have given todays date.
    • merlyn@stonehenge.com
      ... srikanth In perl, how to find date after 5 days, if they have given todays date. my $in_5_days = localtime (time + 5 * 86400); If you want it as values
      Message 2 of 3 , Mar 17, 2008
      • 0 Attachment
        >>>>> "srikanth" == srikanth kovur <srikanth_kovur@...> writes:

        srikanth> In perl, how to find date after 5 days, if they have given todays date.

        my $in_5_days = localtime (time + 5 * 86400);

        If you want it as values instead of a string, use list context
        instead of scalar context. "perldoc -f localtime" for details.


        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • Alexander Saydakov
        ... Try the DateTime package. It can do many things including addition and subtraction of periods of time, which works correctly with respect to a given time
        Message 3 of 3 , Mar 17, 2008
        • 0 Attachment
          --- In perl-beginner@yahoogroups.com, "srikanth_kovur"
          <srikanth_kovur@...> wrote:
          >
          > In perl, how to find date after 5 days, if they have given todays date.

          Try the DateTime package. It can do many things including addition and
          subtraction of periods of time, which works correctly with respect to
          a given time zone with all crazy things like DST transitions, leap
          seconds and such: http://datetime.perl.org/

          Good luck

          /sandy
          http://myperlquiz.com/
        Your message has been successfully submitted and would be delivered to recipients shortly.