playwright Posted July 29, 2010 Share Posted July 29, 2010 Hello!! i want to save datetimes into a mysql database. Their format is dd-mm-yy hh:mm. I think mysql format for datetime is yy-mm-dd hh:mm..How can i convert them?? Quote Link to comment Share on other sites More sharing options...
tomtimms Posted July 29, 2010 Share Posted July 29, 2010 You are going to need to provide more information than this and some code to show us what your talking about. Quote Link to comment Share on other sites More sharing options...
playwright Posted July 29, 2010 Author Share Posted July 29, 2010 Actually i am grabbing datetimes from a text and i want to put them in a db. The format of these datetimes is dd-mm-yy hh:mm. When i put them in the db it shows 0000-00-00 00:00:00 and this happens with all datetimes. I use mysql and datetime type in my table. I think i should do some convertions. Any ideas? Quote Link to comment Share on other sites More sharing options...
tomtimms Posted July 29, 2010 Share Posted July 29, 2010 Sounds like your database structure is iffy, how is your date column setup? Quote Link to comment Share on other sites More sharing options...
litebearer Posted July 29, 2010 Share Posted July 29, 2010 musing, perhaps... $old_way = "27-07-2015 12:31:27"; // dd-mm-yyyy hour:min:sec $new_way = date("Y-m-d h:i:s", strtotime($old_way)); echo $new_way; Quote Link to comment Share on other sites More sharing options...
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.