sayedsohail Posted March 27, 2007 Share Posted March 27, 2007 Hi everyone, when i tried the above code, its displays 01/01/1970. without the date function it display the date correctly but in unix stamp format. any suggestion. Please help. Link to comment https://forums.phpfreaks.com/topic/44475-solved-echo-datedmy-model_date-not-working/ Share on other sites More sharing options...
ted_chou12 Posted March 27, 2007 Share Posted March 27, 2007 u want the date today in dd/mm/yyyy format? date("d/m/Y"); this is enough. Ted Link to comment https://forums.phpfreaks.com/topic/44475-solved-echo-datedmy-model_date-not-working/#findComment-216015 Share on other sites More sharing options...
kenrbnsn Posted March 27, 2007 Share Posted March 27, 2007 The second parameter for the date() function has to be a UNIX timestamp which is an integer, you are passing it a string. You need to convert it to a a UNIX timestamp with the function strtotime(). <?php echo "<td > ".date('d/m/Y', strtotime($model_date))."</td>"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/44475-solved-echo-datedmy-model_date-not-working/#findComment-216018 Share on other sites More sharing options...
sayedsohail Posted March 27, 2007 Author Share Posted March 27, 2007 million thanks guys it works now. Link to comment https://forums.phpfreaks.com/topic/44475-solved-echo-datedmy-model_date-not-working/#findComment-216021 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.