Toon posts:

[php] tijd

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hoi,

Ik heb dus mijn server waar mijn site opstaat in Amerika. En zoals jullie wel weten is er tussen Nederland en Amerika tijds verschil. NU heb ik dat opgelost met:
PHP:
1
<? $nltijd = mktime(date("H")+6,date("i"),date("s"),date("m"),date("d"),date("Y")); echo date("H:i",$nltijd);?>  ?>

Maar nu heb ik dus ook gehoord dat het met:
PHP:
1
<?putenv("TZ=Europe/Amsterdam"); ?>

Maar hoe pas ik dat toe.

  • martinvw
  • Registratie: Februari 2002
  • Laatst online: 14-12-2025
Manual

Onderaan bij de usernotes

Verwijderd

mjah... dit kwam ik tegen op php:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Here is an example of using putenv to change the timezone for the current
script.  You would have to add a putenv() call to each page in which you
wanted to change the timezone.  This was posted here about a year ago...I
forgot the author's name.  He mentioned to "see the zoneinfo
directory-tree on your System for a list". This is usually
/usr/share/zoneinfo or /usr/lib/zoneinfo.  It works in PHP3, not sure
about PHP4.

  //Set the Timezone
print("server timezone is: " . getenv('TZ') .
"\n");
  print("server time is: " . date("H:i:s") .
"\n");
  print("changing server time zone to
US/Pacific....\n");
  putenv("TZ=US/Pacific");
  print("new server time is: " . date("H:i:s") .
"\n");
  print("new server timezone for this script is: " .
getenv('TZ'));

some Unix servers may use a different format for TZ.  Example:
putenv("TZ=PST8EDT");

[edit]
Sh#T toch vaker op F5 drukken |:(

  • martinvw
  • Registratie: Februari 2002
  • Laatst online: 14-12-2025
Iets verder onderaan staat nog iets over nederlandse tijdezones.

Verwijderd

Topicstarter
PHP:
1
<?putenv ('TZ=Europe/Amsterdam');echo date("H:i:s");echo date("d/m/Y");?>

He bedankt ik ben even gaan rotzooien met de dingen die jullie gaven en hij werkt nu perfect. Gewoon zoals bovenstaande.

  • martinvw
  • Registratie: Februari 2002
  • Laatst online: 14-12-2025
:) daar doe je het voor :)
Pagina: 1