What operating system are you using? Support for the %P format code isn't universal. Take a look at the documentation for "strftime" on your system.
You could try using %p instead. Or, alternatively, just use the 24 hour clock (%k in place of %l in the output format string) - that's far more readable in my opinion.
Personally, I'd use the DateTime modules to solve this problem.
--
< http://dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
| [reply] |
Ok, I got it to work, one more question
For some reason I can run it from the shell
but when I incorporate it into my script it crashes it.
and only crashes it from a browser, what am I missing?
{
use Date::Parse;
use Date::Format;
use Date::Language;
$format = '%A, %B %o %l:%M%p';
$language = Date::Language->new('English');
## Start
$date_time = '08/24/06 09:30';
$time = $language->str2time( $date_time ); # 1. Parse
$newtime = $language->time2str( $format, $time ); # 2. Output
{
print "$newtime\n";
}
}
| [reply] |
Could be any number of things. It'll be brought about by the fact that your web server runs scripts under a different user, so the environment will be different.
What do you mean by "crashes"? Does it crash your browser? If you're seeing a 500 error then there will almost certainly be more useful information in the web server error log.
--
< http://dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
| [reply] |