www.webdeveloper.com
Results 1 to 3 of 3

Thread: date format

  1. #1
    Join Date
    Jun 2005
    Posts
    45

    date format

    while creating a data field in a table in mysql, I want to format the date like

    dd/mm/yyyy

    anybody helps??

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,337
    Best bet is to create a standard date or datetime type of column, then use STR_TO_DATE() when inserting/updating and DATE_FORMAT() when selecting from the database. (See http://dev.mysql.com/doc/refman/4.1/...functions.html for more info.)
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jun 2005
    Posts
    45
    I must use that function in php. my value to convert is {$values3[$k][0]}

    and the format must be '%d%m%Y'

    I have tried lots but couldnt find.If u can write me the correct code, I would be glad...

    this was my code

    PHP Code:
    $query "Insert into t1(rowcount,date1,time1,stats,queue,recvfrom,fromm,tto,subj,spam,rule) 
    values(
    $k+1,STR_TO_DATE('{$values3[$k][0]}','%m/%d/%Y'),'{$values3[$k][1]}','{$values2[$k][1]}','{$values2[$k][5]}',
    '
    {$values2[$k][2]}','{$values2[$k][6]}','{$values2[$k][7]}',\"{$values2[$k][3]}\",\"{$values2[$k][4]}\",
    \"
    {$values2[$k][8]}\")"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles