store javascript UTC date in mysql . php -
i have json object provides me date in kind of utc format .
"date":new date(date.utc(2013,1,5,13,53,47))how can store in mysql , kind of column type should utilize ? i'm using php retrieve / store data
store in format of yyyy-mm-dd
. can't quite in single line, seek this:
var d = new date(date.utc(/* stuff */)); ... "date": d.getfullyear() + '-' + d.getmonth() + '-' + d.getdate()
edit:
on php side date
in $_post['date']
. utilize date('y-m-d', strtotime($_post['date']))
value store in mysql.
php javascript mysql datetime
No comments:
Post a Comment