1
trabis
formdatetime.php - Hack sugestion
  • 2008/5/31 0:52

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hi, I´m using this class in a module I´m developing for user to choose a date interval.

The problem is that if your server has diferent time than GMT the date showed( based on time() ) does not match the date that is set for xoops.

I´ve notice this is many modules. Smartsection is an example. When I need to change the time date of the article I cannot choose the displayed data, I have to do some maths to get the right setting.


Thanks!

2
phppp
Re: formdatetime.php - Hack sugestion
  • 2008/5/31 1:55

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Can you please give an example?

3
trabis
Re: formdatetime.php - Hack sugestion
  • 2008/5/31 8:52

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


I think server time and php time are not the same. I live in Portugal so I set my zone time to GMT+0. For time show correctly in my comment posts etc I have to set server time to GMT -5.
However, when using getDate(time()) the return value is not based in this server time(GMT-5), it returns something like GMT-8.
So server time is not equal to php time.

If I had something like

putenv ('TZ=Europe/Lisbon');

then the formdatetime.php return the correct date for me!

This means that before using getDate() or other date functions, we must set a correct time zone for our php.

putenv() requires safe mode. There an alternative function for php 5:

http://php.net/manual/pt_BR/function.date-default-timezone-set.php

Am I missing something?

Login

Who's Online

462 user(s) are online (343 user(s) are browsing Support Forums)


Members: 0


Guests: 462


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits