> -----Message d'origine----- > De : Nishi Prafull [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 3 mars 2005 23:12 > À : Wagner, David --- Senior Programmer Analyst --- WGO > Cc : Jose Nyimi; beginners@perl.org > Objet : Re: RE : Perl program to convert system date to yymmdd > > Hi All: > > Thanks for the replies.It works correctly. > I need to do similar thing for extracting the time in the format hhmm > ie if it 2:05 pm then i need to display 1405 > > If the date command returns > Thu Mar 3 13:56:24 PST 2005 > then > i need to convert the time format to > 1356 > > Please let me know how I can do this. > Thanks.
David has implicitly replied to this ;) Anyway try this: #!perl use strict; use warnings; my($sec,$min,$hour)= localtime(time); my $someTime = sprintf "%02d%02d",$hour,$min; print "$someTime\n"; Regards, José. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>