richiec Posted January 30, 2008 Share Posted January 30, 2008 I will try and explain this best i can, i have an update page where users can select different things and put due at different times... It puts the time and date they chose into a DB.. Currently i have them putting the date in unix format year-month-day (it needs to be for things which i do with the date) but on the page where users can see that date i would like to show it in a different format like day-month-year hopefuly that explains what i want to do... Does anyone know how i can do that? Thanks Rich Quote Link to comment https://forums.phpfreaks.com/topic/88636-solved-unix-date/ Share on other sites More sharing options...
cooldude832 Posted January 30, 2008 Share Posted January 30, 2008 if it is a mysql Date Time field or Date field the function strtotime can convert it to a unix time stamp i.e <?php $date = $row['Date']; $date_reformed = date("m-d-y",strtotime($date); echo "The original date: ".$date."<br />The New Date: ".$date_reformed; ?> [/code Quote Link to comment https://forums.phpfreaks.com/topic/88636-solved-unix-date/#findComment-453867 Share on other sites More sharing options...
dfowler Posted January 30, 2008 Share Posted January 30, 2008 date("d-m-Y", strtotime($data)); That should get you going. Quote Link to comment https://forums.phpfreaks.com/topic/88636-solved-unix-date/#findComment-453869 Share on other sites More sharing options...
richiec Posted January 30, 2008 Author Share Posted January 30, 2008 that worked great thank you both! ~Rich Quote Link to comment https://forums.phpfreaks.com/topic/88636-solved-unix-date/#findComment-453904 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.