|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
date and time [ php --> perl ]
php to perl [ date and time ]
Hi, Im trying to find todays date and time in perl.. how do i do that?? I know how to do it in php.. but i dont know how to convert the php to perl ![]() this is what i am doing in php $date = date("m-d-y"); $time = date("g:i a T"); I want a replica of this output in perl.. any help would be great! |
|
#2
|
|||
|
|||
|
Hopefully this will help, I'm not too great at perl myself.
--------------------------------------------------------------- #usr/bin/perl -w use POSIX qw(strftime); $nowdate = strftime "%m-%d-%y", localtime; $nowtime = strftime "%I:%M %p %Z", localtime; print "$nowdate\n"; print "$nowtime\n"; --------------------------------------------------------------- This is pretty much straight from the perl documentation which you can check out here: http://www.perldoc.com/perl5.6/pod/localtime.html for more info on the format strings try: % man date on your server. -Jake- |
|
#3
|
|||
|
|||
|
You could also just do:
Code:
$time = localtime; That will give you a string with the day time and date.
__________________
- dsb - ![]() Perl Guy |
|
#4
|
|||
|
|||
|
thanks.. problem solved
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > date and time [ php --> perl ] |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|