CAST / Date_FORMAT function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jimmy

    #1

    CAST / Date_FORMAT function

    Hi,

    I'm new to MySQL and I have qustion regarding to CAST and Date_Format
    functions. I'm trying to convert a column 'Time' varchar(50) to
    datetime datatype by "select date_format(cas t(time as datetime),
    '%m/%Y') from yo where id = 1" but the data returns incorrectly. For
    example, the id 1 the time is '28-4-2004-4:11' once I ranthe query,
    the return data is 04/2028. Looks like MySQL treated 28 as the year.
    What can I do to make it returns correct info as 04/2004?

    Thanks for your help!
    JL
Working...