Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   PHP (http://www.flasher.ru/forum/forumdisplay.php?f=20)
-   -   dates -- > local and gmt (http://www.flasher.ru/forum/showthread.php?t=36413)

Gandalf 28.08.2002 23:08

dates -- > local and gmt
 
vsem privet,

function time() daet UNIX timestemp servernogo vremeni ..... kak mne poluchit' GMT vremja esli ja ne znau gde naxodit'sja server ?????
HELP

ninetyniner 31.08.2002 01:49

The local time is not included in HTTP request, therefore there is no way you can get it using PHP directly. You can solve this problem by asking your visitors to provide their GMT timezone once and then write it to the cookies. Another option is to use JavaScript for getting user's local time and then pass it to the PHP script. Something like this:

Код:

<script type="text/javascript">
var CurrentDate = new Date();
var CurrentHour = CurrentDate.getHours();
var CurrentMinute = CurrentDate.getMinutes();
window.location = "page.php?hour=" + CurrentHour + "&minute=" + CurrentMinute;
</script>

and then, in your PHP script:

Код:

// ...................................
$CurrentHour = $HTTP_GET_VARS["hour"];
$CurrentMinute = $HTTP_GET_VARS["minute"];
// ...................................


Gandalf 05.09.2002 01:27

ninetyniner
You see i don't care about USER time and zone , i need server time and i need to know what zone server is in after that i can calculate GMT time based on server time and zone .......

function time(); gives you server not user time.


THE END GOAL is to know server time zone. Not gmt or any other time.

Gandalf 25.09.2002 09:56

up

Crazy 25.09.2002 10:13

Прости, я не очень понял, что ты хочешь получить:

1. GMT-время на сервере?
2. Время на сервере в его локальной временной зоне?

Если первое -- gmdate(), если второе -- date().

Разумеется, для правильной работы обеих функций сервер должен быть адекватно настроен.

Gandalf 01.10.2002 06:01

kogda ja delau time(); servak mne daet unix timestemp vremenni kotoroe na servere. vse xorosho NO ento ne GMT vremja , a mne nuzno ono ...... t.k. potom ento vremja budet ispol'zovat'sja s opredelennoi vremennoi zonnoi !

mne nado uznat' kakaja vremennaja zona stoit v nastroikax OS na servere , chto bi delat' normal'nuu GMT datu ( ja ne ispol'zuu timestemp (pishu datu v svoem formate) i posle delat' s nei ve chto mne zaxochet'sja!
Crazy Разумеется, для правильной работы обеих функций сервер должен быть адекватно настроен.
a esli on ne pravil'no nastroen ?!!?

Crazy 01.10.2002 06:56

gmstrftime()


Часовой пояс GMT +4, время: 17:52.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.