Re: Date formatting
- From: usenet@xxxxxxxxxxxxxxx
- Date: 30 Dec 2005 16:30:50 -0800
stagepin wrote:
> I receive $date in this format: yyyymmdd (For example: 20051230)
> I need to display it as "December 30, 2005"
How about using the Date::Manip module, which does nearly everything
you could ever want to do regarding time/dates:
#!/usr/bin/perl
use Date::Manip;
print UnixDate ('20051230', "%B %e, %Y");
__END__
If you want abbreviated months ('Dec' instead of 'December') use "%b"
instead of "%B". You didn't state a display preference about
single-digit days (ie, 'Dec 5' vs 'Dec 05'); this will show
single-digit days without a leading zero (use "%d" instead of "%e" if
you want leading zeros on single-digit days). See
http://search.cpan.org/~sbeck/DateManip-5.44/Manip.pod
Cheers!
.
- References:
- Date formatting
- From: stagepin
- Date formatting
- Prev by Date: Re: please help find logic error in home-brewed brute force anagram solver/creator script
- Next by Date: Re: please help find logic error in home-brewed brute force anagram solver/creator script
- Previous by thread: Date formatting
- Next by thread: A "sub" question...
- Index(es):