Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date Comparisons

    I would like to pull some info from an error file....

    The date is stored like: Aug 18 2003.

    I have a html form with 2 dates - from and to.

    If I put these input dates in the same format, I can't compare is it gives funny answers!

    If I make the input dates like 16/08/2003 and 20/08/2003, how can I convert the date in the error file to look like this?

    Thanks

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ehm.. are these two separate questions is the last one only needed if you don't get the date comparisons to work?

    Usually you convert a date into an integer called UNIX timestamp. It's just a big number and stands for the seconds passed since the date in question and 1.1.1970.

    To convert your date, you could use

    PHP Code:
    $time strtotime('Aug 18 2003'); 
    After that, you can compare each date with others to see which one is greater or lower or whatever.
    De gustibus non est disputandum.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks - thats exactly what i'm after...


  •  

    Posting Permissions

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