Modify date() to give gmt
Moderator: General Moderators
-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
Modify date() to give gmt
<?php
echo (date("G:i , D d M Y"));
?>
This gives the time of the computer runned in.
Is there a easy way to modify the hours date results, something like date("G+5:i , D d M Y")
echo (date("G:i , D d M Y"));
?>
This gives the time of the computer runned in.
Is there a easy way to modify the hours date results, something like date("G+5:i , D d M Y")
Code: Select all
echo date("G:i , D d M Y",strtotime("now +5 hours"));-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
Gives nice gmt time.
Code: Select all
echo date("G:i",strtotime("now +6 hours"))." GMT, ".date("D d M Y");-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
That's strange, it's always worked for me. By default time() will/should give you a unix-timestamp (time of seconds since January 1 1970 00:00:00 GMT) which by default is GMT as you can see.
Might be worth checking out [php_man]date[/php_man] [php_man]time[/php_man] and [php_man]mktime[/php_man] in the manual.
Might be worth checking out [php_man]date[/php_man] [php_man]time[/php_man] and [php_man]mktime[/php_man] in the manual.
-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
You're correct. i didnt had exactly that you suggested but
instead.
But now i'm allready much more wiser
Code: Select all
echo date("G:i , D d M Y",strtotime("now +5 hours"));But now i'm allready much more wiser