how to validate date using php?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nirmalsingh
    New Member
    • Sep 2006
    • 218

    how to validate date using php?

    hi all,
    i use (from date) and (to date) in a form, if user enter from date greater than to date i have to validate it and show error!. how could i do this?
  • satya61229
    New Member
    • Feb 2007
    • 24

    #2
    Originally posted by nirmalsingh
    hi all,
    i use (from date) and (to date) in a form, if user enter from date greater than to date i have to validate it and show error!. how could i do this?
    PHP can directly compare date.
    If ($d1 > $d2) .............

    if it does not work for you then you can use
    strtotime() for each date and compare them using if ()..

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      You are double posting in this forum! The dup will be removed. Don't do that!

      moderator

      Comment

      Working...