SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    UK
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem comparing strings to see if a date is 0000

    Got dates stored in mysql yyyy-mm-dd

    Pulling this out and then I want to check if year is 0000.

    PHP Code:
    if(substr($all_birthdays[$i]['birthday'],0,4) == "0000"
    However this code does not work (always evaluates false).

    Tried it with strcmp, and even casting to string but nothing seeme to work!

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try
    PHP Code:
    if(date("Y"strtotime($all_birthdays[$i]['birthday'])) == "0000"
    Kayzio - We don't hesitate, we accelerate.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •