#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Nobbies beach, Gold Coast. It's beautiful.
    Posts
    2,575
    Rep Power
    171

    Check string format and convert.


    Hi;

    $_GET['entry'] is sent to a page and it could be different formats.

    How can I check

    If the format of $_GET['entry'] is like 'yyyy-mm-dd'

    Then change the format like this:

    date(d/m/y', strtotime($_GET['entry']))?

    Thanks
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    Regex to validate the format and grab the pieces (explode() can do that part too), checkdate() to validate the date unless you don't mind over- and underflows with numbers, then the reformatting which you've already answered but could also be done with mktime() since you have the pieces.

IMN logo majestic logo threadwatch logo seochat tools logo