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. Quote 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 Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.