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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    439
    Thanks
    7
    Thanked 3 Times in 3 Posts

    converting DD-MM-YYY to time

    Can anyone please tell me how I convert DD-MM-YYY (text) to TIME (unix)

    thought I'd say that I have this line at the top of all my pages, just in case it means a different code.

    Code:
    date_default_timezone_set('Europe/London');	//### Set the default timezone

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    d-m-y is a valid gnu format. Use
    PHP Code:
    $timestamp strtotime('1-1-2012'); 
    If its already in SQL you can call the databases method of conversion. MySQL uses UNIX_TIMESTAMP that should accept a valid datetime type in SQL.


  •  

    Posting Permissions

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