Mar 28, 2006 #1 DarVar Programmer Joined Mar 14, 2006 Messages 10 Location IE Hi I want to be able to print out the date in a formatted string The format doesn't particularly matter Something like this Tue Mar 28 16:02:04 I read about localtime?? print "$localtime
Hi I want to be able to print out the date in a formatted string The format doesn't particularly matter Something like this Tue Mar 28 16:02:04 I read about localtime?? print "$localtime
Mar 28, 2006 #2 columb IS-IT--Management Joined Feb 5, 2004 Messages 1,231 Location EU Without wishing to preach RTFM too much - have you looked at this page whcih gives all the perl builtin functions. Columb Healy Upvote 0 Downvote
Without wishing to preach RTFM too much - have you looked at this page whcih gives all the perl builtin functions. Columb Healy
Mar 28, 2006 #3 Xaqte IS-IT--Management Joined Oct 4, 2002 Messages 971 Location US How about this: Code: #!/usr/bin/perl use strict; use warnings; my $now = scalar(localtime(time)); print $now; Let us know your results! X Upvote 0 Downvote
How about this: Code: #!/usr/bin/perl use strict; use warnings; my $now = scalar(localtime(time)); print $now; Let us know your results! X
Mar 28, 2006 #4 KevinADC Technical User Joined Jan 21, 2005 Messages 5,070 Location US or simply: print scalar localtime(); if you wanted to print the current time and date, or: print scalar gmtime(); for gm time. Upvote 0 Downvote
or simply: print scalar localtime(); if you wanted to print the current time and date, or: print scalar gmtime(); for gm time.
Mar 28, 2006 #5 Kirsle Programmer Joined Jan 21, 2006 Messages 1,179 Location US There's a module you can get from CPAN called Time::Format. Code: use Time::Format; print time_format ('Weekday, Month dd yyyy @ H:mm{in}:ss A.M.'); "Tuesday, March 28 2006 @ 5:29:30 P.M." http://search.cpan.org/perldoc?Time::Format Upvote 0 Downvote
There's a module you can get from CPAN called Time::Format. Code: use Time::Format; print time_format ('Weekday, Month dd yyyy @ H:mm{in}:ss A.M.'); "Tuesday, March 28 2006 @ 5:29:30 P.M." http://search.cpan.org/perldoc?Time::Format
Mar 29, 2006 Thread starter #6 DarVar Programmer Joined Mar 14, 2006 Messages 10 Location IE Hi, I used the code posted by Xaqte It works fine on its own but I get the following printed out in my script: Time::tm=ARRAY(0x1c3148)[Time::tm=ARRAY(0x1c3148)] Upvote 0 Downvote
Hi, I used the code posted by Xaqte It works fine on its own but I get the following printed out in my script: Time::tm=ARRAY(0x1c3148)[Time::tm=ARRAY(0x1c3148)]