Php Date conversion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SSG001
    New Member
    • Oct 2007
    • 110

    Php Date conversion

    I have dates stored in the format MONYY eg. MAR08

    I want to COMPARE this dates to the format (YYYY-MM-DD) EG.2009-01-
    01



    Kindly Help

    Thanks
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    How are you storing these dates?
    If they are being stored in any decent database system, you would most likely be far better of using that system's date type. Like the DATE type, found in pretty much all SQL servers.

    In any case, you would have to convert either format to match the other, or simply extract the year and month from both and compare them.

    The substr function should help you there.

    Comment

    • SSG001
      New Member
      • Oct 2007
      • 110

      #3
      I Want to check if the date which is stored as MONYY in the database is less then 2008-03-31

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Originally posted by SSG001
        I Want to check if the date which is stored as MONYY in the database is less then 2008-03-31
        Yes, and like I said in my previous post, to do that you will have to extract the month and year parts and convert them into a format that you can compare.

        If your having trouble doing that, show us what you have tried, and we might be able to point out what the problem is.

        Comment

        Working...