-3

Possible Duplicate:
How to compare the date parts of two Zend_Date objects?

I've been trying to compare dates, but for some reason things don't seem to work as I want them to. I'm trying to log to a database whenever someone logs into my site on a certain day. I've used if (date("j F") == "25 July") followed by my code, but it doesn't seem to trigger. I intend to get it to check for a lot of things, such as Friday 13, 17 March, etc (obviously I know I'll need to change the date() format for Friday 13). The current check of 25 July is a copy from an echo of date(), so I know it's definitely not a typo. Can anyone tell me why this isn't working, and how to do it? Cheers

Community
  • 1
  • 1

1 Answers1

0

The best method is to use a strtotime function. But I think it won't work until you specify year in the date.

Not sure about it though. But strtotime is a good option.

hjpotter92
  • 78,589
  • 36
  • 144
  • 183