justinbriggs1 Posted December 9, 2010 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. Link to comment Share on other sites More sharing options...
justinbriggs1 Posted December 9, 2010 Author 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') Link to comment Share on other sites More sharing options...
[dx] Posted December 10, 2010 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.