Jump to content


Photo

Compare Times


  • Please log in to reply
3 replies to this topic

#1 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 19 September 2006 - 01:57 PM

I can't seem to remember how to do it properly...

How do I check the current time against 1 hour ago using mktime?

mktime() <= mktime(-1,0,0,0) ??

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 19 September 2006 - 02:01 PM

Best way, imo, is using strtotime().

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 19 September 2006 - 02:20 PM

I've tried:

date("M-d_Y h:m:s", strtotime("-1 hour");

Which worked, but when I tried:
date("M-d-Y h:m:s", strtotime("-10 minutes")
it didnt work.

Though
date("M-d-Y h:m:s", strtotime("-60 minutes")
does work....

How do I check if 10 minutes has past??

I set a session varible strtotime("now") which gets the unix timestamp of that moment, then I want to check that to see if at least 10 mins has passed since.



#4 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 19 September 2006 - 02:50 PM

Alright I figured it out....... dumb me

date("M-d-Y h:i:s", strtotime("-10 minutes"))

I was using 'm' and not 'i' for minutes ;)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users