Jump to content


Photo

Getting a GMT time stamp in my scripts


  • Please log in to reply
3 replies to this topic

#1 MortimerJazz

MortimerJazz
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts
  • LocationBedfordshire

Posted 16 October 2006 - 12:46 PM

Hi there - thanks for taking the time to read this,

I've just written a login script in PHP that inserts the time that the user last logged in.

Up until now I've been using now() ... but that doesn't insert the time in GMT.

Having looked through PHP.net I came across date_default_timezone_set('GMT') and thought that was the answer I was looking for, but the PHP manual says this function will only work in PHP v5.1 ... and my host isn't currently running that.

So my question is, is there another way to insert a time stamp in GMT format?

Thanks for the help,

Si

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 16 October 2006 - 12:52 PM

gmdate('r');

#3 MortimerJazz

MortimerJazz
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts
  • LocationBedfordshire

Posted 16 October 2006 - 01:17 PM

Thanks Daniel - so it would just be a case of replacing now() with gmdate('r');?

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 16 October 2006 - 01:34 PM

Well, PHP do not have a function called now(), but check this out: http://php.net/gmdate




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users