When logging times, I use GMT.
strftime() is an expensive critter in terms of perforance. BUT, expensive is relative and often this does not matter. Use if it you want to. Other ways shown below.
#!/usr/bin/perl -w use strict; use Time::Local; # Sets the current time to 5 seconds past midnight on Oct 28, 2008. my $start_time = timelocal(5,0,0,28,10-1,2008); my $start_time_string = localtime($start_time); print "Local time=$start_time_string\n"; #Tue Oct 28 00:00:05 2008 foreach my $delta_days (1..35) { my $new_time = $start_time; $new_time = $start_time + ($delta_days*24*60*60); my $new_time_string = gmtime($new_time); print "$new_time_string\n"; } __END__ OUTPUT: Local time=Tue Oct 28 00:00:05 2008 Wed Oct 29 07:00:05 2008 Thu Oct 30 07:00:05 2008 Fri Oct 31 07:00:05 2008 Sat Nov 1 07:00:05 2008 Sun Nov 2 07:00:05 2008 Mon Nov 3 07:00:05 2008 Tue Nov 4 07:00:05 2008 Wed Nov 5 07:00:05 2008 Thu Nov 6 07:00:05 2008 Fri Nov 7 07:00:05 2008 Sat Nov 8 07:00:05 2008 Sun Nov 9 07:00:05 2008 Mon Nov 10 07:00:05 2008 Tue Nov 11 07:00:05 2008 Wed Nov 12 07:00:05 2008 Thu Nov 13 07:00:05 2008 Fri Nov 14 07:00:05 2008 Sat Nov 15 07:00:05 2008 Sun Nov 16 07:00:05 2008 Mon Nov 17 07:00:05 2008 Tue Nov 18 07:00:05 2008 Wed Nov 19 07:00:05 2008 Thu Nov 20 07:00:05 2008 Fri Nov 21 07:00:05 2008 Sat Nov 22 07:00:05 2008 Sun Nov 23 07:00:05 2008 Mon Nov 24 07:00:05 2008 Tue Nov 25 07:00:05 2008 Wed Nov 26 07:00:05 2008 Thu Nov 27 07:00:05 2008 Fri Nov 28 07:00:05 2008 Sat Nov 29 07:00:05 2008 Sun Nov 30 07:00:05 2008 Mon Dec 1 07:00:05 2008 Tue Dec 2 07:00:05 2008

In reply to Re^5: Date Time problem. by Marshall
in thread Date Time problem. by Karger78

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.