slashng Posted November 13, 2006 Share Posted November 13, 2006 Hi,I having problem with converting the format of the date:$_POST['date'] = "13-11-2006";echo $_POST['date']."<br>";echo date("Y-m-d",strtotime($_POST['date']));OUTPUT:13-11-20062019-04-29-------------------I want my Output to be 13-11-20062006-11-13--------------------Please advise!Thanks! Link to comment https://forums.phpfreaks.com/topic/27100-problem-with-date-formating/ Share on other sites More sharing options...
obsidian Posted November 13, 2006 Share Posted November 13, 2006 DD-MM-YYYY is not a readable format by strtotime(). It is expecting a YYYY-MM-DD or MM/DD/YYYY format instead. So, you'll want to run a little altering to get it to be recognized:[code]<?php$date = "13-11-2006";echo $date;list($d, $m, $y) = explode('-', $date);echo "$y-$m-$d";?>[/code]Good luck Link to comment https://forums.phpfreaks.com/topic/27100-problem-with-date-formating/#findComment-123911 Share on other sites More sharing options...
slashng Posted November 13, 2006 Author Share Posted November 13, 2006 ThanKS!It WorkS!Thanks thanks thanks.... Link to comment https://forums.phpfreaks.com/topic/27100-problem-with-date-formating/#findComment-123912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.