Dates

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 23, 2011   (RSS)

By rjbathgate - June 22, 2011

Hello,

I'm a little confused about some time/date stuff...

I have Timezone set in Regional Settings as NZ(+12). Localtime and mySQL time are the same, and correct to NZ (+12)

Using website membership, the createdDate is set to GMT, whilst the last login is set to the correct local time.

The createdDate is done using:
$currentDate = date("Y-m-d H:i:s", getAdjustedLocalTime());

on the register form.

Removing getAdjustedLocalTime results in the same, GMT.

Example:
I register in NZ Time, 13:00.
CreatedDate recorded as 01:00 (which is -12)
Last Login Date recorded as 13:00

So I was expecting the getAdjustedLocalTime to give me one or the other, but removing it makes no difference.

I want to have the registered time as NZ Time regardless of where the user is in the world (i.e. registered time = server time).

Am I just missing a trick here?

Thanks

Re: [rjbathgate] Dates

By Jason - June 23, 2011

Hi,

If your mySQL time is correct, you could use the mysql NOW() function, instead of getting the current time from PHP,

For example:
createdDate = NOW(),



http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_now


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/