Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   howto Date Time string from MYSQL to German Format (http://www.velocityreviews.com/forums/t905046-howto-date-time-string-from-mysql-to-german-format.html)

sanitarysystems@googlemail.com 10-21-2007 10:58 AM

howto Date Time string from MYSQL to German Format
 
I want to format DateTime string which looks like "2007-10-12
14:00:00" to German Format like "Montag, den 12. Oktober 2007"

This code (1) does not work:
$german_date = ParseDate('2007-10-12 14:00:00');
printf ("Minverbraucht : %s\n",Date_to_Text_Long($german_date));

this code (2) works, because @anliefertag is already formatted as
DateTime:
printf ("Anliefertag : %s\n",Date_to_Text_Long(@anliefertag))

any solutions from you how to format dateTime in example (1)?

tnx in advance
thomas


Mumia W. 10-21-2007 12:54 PM

Re: howto Date Time string from MYSQL to German Format
 
On 10/21/2007 05:58 AM, sanitarysystems@googlemail.com wrote:
> I want to format DateTime string which looks like "2007-10-12
> 14:00:00" to German Format like "Montag, den 12. Oktober 2007"
>
> This code (1) does not work:
> $german_date = ParseDate('2007-10-12 14:00:00');
> printf ("Minverbraucht : %s\n",Date_to_Text_Long($german_date));
>
> this code (2) works, because @anliefertag is already formatted as
> DateTime:
> printf ("Anliefertag : %s\n",Date_to_Text_Long(@anliefertag))
>
> any solutions from you how to format dateTime in example (1)?
>
> tnx in advance
> thomas
>



use strict;
use warnings;
require Date::Parse;
require Date::Language;
Date::Parse->import;
my $lang = Date::Language->new('German');

my $german_date = str2time('2007-10-12 14:00:00');
print $lang->time2str("%a den %e, %B %Y\n", $german_date);


__OUTPUT__
Fre den 12, Oktober 2007

__HTH__


All times are GMT. The time now is 01:43 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.