SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help on sql datetime format

    can anybody show to to convert datetime function in to this..


    mm-dd-yy hh:mm:ss Am or Pm.
    format:
    03-03-2011 3:56:46 pm

    Thanks..

  2. #2
    SitePoint Enthusiast derokorian's Avatar
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well since this is in the php forums I assume you mean within a php script, so you could use mktime(hh,mm,ss,MM,DD,YY)

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    PHP Code:
    $sql_date "2011-04-02 12:00:00";

    echo 
    date("m-d-Y h:i:s a"strtotime($sql_date));

    //04-02-2011 12:00:00 pm 
    Where output is governed by the date formatting rules found in PHP: date - Manual


Bookmarks

Posting Permissions

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