MYSQL: How do I set a date (makedate?) with month, day, and year

Posted by chongman on Stack Overflow See other posts from Stack Overflow or by chongman
Published on 2010-03-13T03:02:38Z Indexed on 2010/03/13 3:07 UTC
Read the original article Hit count: 277

Filed under:
|
|
|

Hi?

I have three columns, y, m, and d (year, month, and day) and want to store this as a date.

What function would I use on mySQL to do this?

Apparently makedate uses year and day of year (see below), but I have month.

I know I can use STR_TO_DATE(str,format), by constructing the string from (y,m,d), but I would guess there is an easier way to do it.

REFERENCES

MAKEDATE(year,dayofyear)

Returns a date, given year and day-of-year values. dayofyear must be greater than 0 or the result is NULL.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about date