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

Thread: time format

  1. #1
    Banned
    Join Date
    Aug 2002
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    time format

    Hi how are you doing? I would like to format time for my guestbook. but I get error

    I did like this

    PHP Code:

    $sql
    ="select name,location,url,comments,date_format(msgtime, \"%Y/%m/%d %H:%i:%s\") as mtime from guestbook order by msgtime desc";

    and
    and 
    take out time from my database
    echo $row["msgtime"]; 
    I got an error.
    PHP Code:
    NoticeUndefined indexmsgtime in c:itoguestbookview.php on line 23 
    Could you tell me the right command to format date?

    Thanks all

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The SQL query looks okay, it's maybe just that you retrieve the formated value "as mtime", so you have to access this value by using "mtime" as the index, like:

    PHP Code:
    echo $row["mtime"]; 


  •  

    Posting Permissions

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