justinbriggs1 0 Posted December 9, 2010 Report Share Posted December 9, 2010 Hey everyone, just a quick question. I am attempting to convert some string values intoa date format, but I can't seem to figure out how to do it with one statement. Here is what I have:UPDATE student_apps_copy SET submitdate = STR_TO_DATE(submitdate,'%d,%m,%Y')This doesn't work obviously, but maybe you can see what I am trying to do.Any help would be appreciated. Quote Link to post Share on other sites
justinbriggs1 0 Posted December 9, 2010 Author Report Share Posted December 9, 2010 This is what I was looking for. just didn't set the second parameter correctly:UPDATE student_apps_copy SET submitdate = STR_TO_DATE(submitdate,'%m/%d/%Y') Quote Link to post Share on other sites
[dx] 4 Posted December 10, 2010 Report Share Posted December 10, 2010 I rather use $_SERVER['REQUEST_TIME'] or time(), in format like this 1292009343, which is standard, and it started counting secs from Thu Jan 01 01:00:00 1970. So it means that 1292009343 seconds passed from 1.1.1970. And it's equal to this: Fri Dec 10 20:29:03 2010Later, when u call that number from sql, u don't need use format like u have inserted. example: 12/10/2010Just use date() with proper parameters. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.