CptDondo wrote:
On Sun, 09 Mar 2008 22:19:31 -0500, Jerry Stuckle wrote:
>CptDondo wrote:
>>I have a very basic shell script that I would like to include on my
webpage, so I'd like to translate it to php:
#!/bin/sh
LANG=ja_JP.UTF-8 TZ=JST-9 date
LANG=cs_CZ.UTF-8 TZ=MET-1METDST date
LANG=en_US.UTF-8 TZ=PST3PDT date
In short, it displays the date and time for a region in that region's
language and default format.
I've been poking around php but I can't find where to set the
equivalent of TZ and LANG for the date() function...
These are set with the date.timezone PHP configuration parameter. The
default is in your php.ini file; you can change it with ini_set(), i.e.
so...
ini_set('date.timezone', 'PST3PDT');
echo date();
ini_set('date.timezone', 'MET-1METDST');
echo date();
or would that make something blow a gasket?
It should work, although I've never tried it.
What about
date_timezone_set()
I can't find any usage examples....
--Yan
You can use date_default_timezone_set(), but that takes a different
argument, i.e. America/LosAngeles instead of PST3PDT (which I think
should be PST8PDT instead).
See the description in the manual for date_default_timezone_set; it has
a link to the appendix which lists the accepted timezones.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================