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 4 of 4

Thread: Date and Time ?

  1. #1
    New Coder DjDanHayden's Avatar
    Join Date
    Nov 2008
    Location
    Ireland
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Date and Time ?

    PHP Code:
    $challenges=mysql_query("SELECT challid,challgrid,challgdid,challgrname,challgdname,DATE_FORMAT(created,'%M %d'),DATE_FORMAT(created,'%l:%i') FROM challenges WHERE challgrid='$team[id]' OR challgdid='$team[id]' ORDER BY created DESC");
                        while(list(
    $challid,$challgrid,$challgdid,$challgrname,$challgdname,$created,$time)=mysql_fetch_row($challenges)) 

    I want the varaible $time to only show the time, it keeps outputting the date before it.

    Can anyone help ?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    How are you printing it? DATE_FORMAT of %l:%i should just be 1:14 for example (you may want to add in an %p as well to tell if its AM or PM).

  • #3
    New Coder DjDanHayden's Avatar
    Join Date
    Nov 2008
    Location
    Ireland
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    How are you printing it? DATE_FORMAT of %l:%i should just be 1:14 for example (you may want to add in an %p as well to tell if its AM or PM).

    This is what it prints: 2012-01-23 15:00:00


    All i want is the time...

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    yes, and I'm saying that the SQL doesn't appear to do that. What I mean is what code are you using to actually print this out?


  •  

    Posting Permissions

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