Timezone setting

software development

#1

Hi 2 all…
I’m using phpnuke, but naturally I don’t come from US ( I come from Italy) so I have proble to autoload news that use time zone. Infact I always see US time when I try tu use timeform php function

fab10


#2

if you look at the time function, the second argument is the offset…

using unixtimestamp look in www.php.net/date


#3

[quote]
using unixtimestamp look in www.php.net/date[/quote]
And to go that “extra mile” for our Italian bretheren:
http://us2.php.net/it/date

…but I’m not so very sure if that applies in PHPNuke. In fact, I don’t know nothin’ about PHPNuke - sounds perfectly awful if ya ask me. It may be that you have to create and edit an .htaccess file in the working directory of your script to contain a line that reads:

SetEnv TZ GMT_2…where the “_” is actually a plus-sign (stupid BBS software doesn’t allow plus-signs to be posted). That is, I’m pretty sure Italy is GMT-plus-2-hours.
Ciao!


#4

but I have to create a .htaccess file for every directory of my site where I use a date/time function?


#5

Naturally I already try to create .htaccess with
SetEnv GMT+1 ( italy GMT)

without success!

Normally I use this date format function

function formatTimestamp($time) {
global $datetime, $locale;
setlocale (LC_TIME, $locale);

ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
$datetime = ucfirst($datetime);
return($datetime);
}

where _DATESTRING is
define("_DATESTRING","%A %d %B %G @ h.%R %Z");

and server return to me

Thursday 15 September 2005 @ h.02:56 PDT
but I wanna have something like

Martedì 15 Settembre 2005 @ h.11:56 GMT+1

obviuosly my local time

fab10


#6

Okay - I did some documentation research and a bunch of tests, and it looks like this is a job for DH tech support, as it requires localization file to be generated at the OS level; I tried every possible variation of the PHP “setlocale()” command for Italian language settings and it returned a “false” status.