![]() |
Format Date/Time in Perl
On 17th December, 2008
|
Recent Articles
Similar Articles
Basics Basic formatting of datetime in Perl is done by writing your own formatting logic, we'll use the localtime function to get the current datetime details. For more info about the locatime function checkout http://perldoc.perl.org/functions/localtime.html Code: Perl
Enter POSIX::strftime The strftime function helps to format time information to string using pre-defined formatting parameters. Here's how we go about it, you might need a list of formatting string codes found at http://www.mkssoftware.com/docs/man3/strftime.3.asp Code: Perl
You can format the way you like it using the format parameters, I personally feel this is the easiest way to format datetime in Perl for daily use. Using Date::Calc The Perl module Date::Calc's primary use is date manipulation, but it may also be used formatting dates to some extent, you may read the module's docs at http://search.cpan.org/~stbey/Date-Calc-5.4/Calc.pod Code: Perl
Hope this write-up was helpful. Happy coding. |
|
|
#2 |
|
Ambitious contributor
Join Date: Feb 2008
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 ![]() |
Re: Format Date/Time in Perl
Nice article....I have taken printout of it ...n will read @ home..
|
|
|
|
|
|
#3 |
|
Contributor
|
Re: Format Date/Time in Perl
Nice
|
|
|
|
|
|
#4 |
|
Go4Expert Founder
![]() |
Re: Format Date/Time in Perl |
|
|
|
|
|
#5 |
|
Light Poster
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 ![]() |
Re: Format Date/Time in Perl
Nice article.....
__________________
Download NY Web Development |
|
|
|
![]() |
|
| Currently Active Users Reading This Article: 2 (0 members and 2 guests) | |
| Article Tools | Search this Article |
| Display Modes | |
| Bookmarks | |
|
|
|
|||||||||||||||||||||||||||||||||||||