Re: Using DateTimeZone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lester Caine schreef:
> Lester Caine wrote:
>>> <?php
>>>
>>> setlocale(LC_TIME, "nl_NL.ISO8859-1");
>>> $d = new DateTime();
>>> echo strftime("%A, %d %B %Y", strtotime($d->format(DATE_ATOM))), "\n";
>>>
>>> ?>
> 
> Does not work!

it does, only there is nothing setting the timezone in that example.

> Have to do
> 
> date_default_timezone_set( $user_timezone ) );
> if ( is_numeric( $user_time )) {
>     $dateTimeUser = new DateTime( '@'.$user_time );
> } else  {
>     $dateTimeUser = new DateTime( $user_time );
> }
> $disptime = strtotime($dateTimeUser->format(DATE_W3C));
> echo strftime( $format, $disptime );
> 
> Even to get the right day!
> 
> But as yet I have not seen ANYTHING other than English text :(
> The next battle is to get it translated.

you have to use setlocale() with the relevant locale for the
translation your looking for before strftime() will give up something
in english.

don't pity you in your date battles, date's are a pita :-P

> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux