Ronald Yacketta wrote:
> From: Praful Bajaria [mailto:[EMAIL PROTECTED]
> >
> >
> > All,
> >
> > How would I get ddmmyyyy format of time in a variable.
> > Once I get this format (value in variable),I would
> > like to append to a file.
> >
> > $currtime = time();
> > @currtime = gmtime($currtime);
> > print " @currtime \n ";
> >
> > but the above code doen't give me yyyy.
>
> use Time::Local;
> use POSIX;
>
> $TODAY          =       strftime("%d%m%Y", localtime());
>
> print $TODAY;
>
> 13062003
>
>

That's a good way to do it, but the POSIX module is /huge/. If
this is all you want of it then the following is more concise.

HTH,

Rob


  my @dmy = (localtime)[3..5];
  $dmy[1] ++;
  $dmy[2] += 1900;
  my $dmy = sprintf "%02d%02d%04d", @dmy;

  print $dmy, "\n";

OUTPUT

  13062003




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to