spires Posted May 13, 2008 Share Posted May 13, 2008 Hi Guys. what parameter do I need in the date function to output - 3rd March 08 Quote Link to comment Share on other sites More sharing options...
revraz Posted May 13, 2008 Share Posted May 13, 2008 http://us3.php.net/date Quote Link to comment Share on other sites More sharing options...
soycharliente Posted May 13, 2008 Share Posted May 13, 2008 All of the codes can be found here: http://us3.php.net/date <?php echo date("jS F y", $thedate); ?> Quote Link to comment Share on other sites More sharing options...
spires Posted May 13, 2008 Author Share Posted May 13, 2008 Thats excellent - Thanks :-) Quote Link to comment Share on other sites More sharing options...
soycharliente Posted May 13, 2008 Share Posted May 13, 2008 Mark SOLVED please. Quote Link to comment Share on other sites More sharing options...
spires Posted May 13, 2008 Author Share Posted May 13, 2008 Thats excellent - Thanks :-) I've tried: <?php $thedate = date("Y m d"); echo date("jS F y", $thedate); ?> But the code only echos 1st January 70. Any ideas? Quote Link to comment Share on other sites More sharing options...
947740 Posted May 13, 2008 Share Posted May 13, 2008 $thedate has to be a UNIX timestamp. E.G. $thedate = strtotime("now"); Quote Link to comment Share on other sites More sharing options...
soycharliente Posted May 13, 2008 Share Posted May 13, 2008 Use strtotime. http://us.php.net/strtotime <?php $thedate = date("Y m d"); echo date("jS F y", strtotime($thedate)); ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted May 13, 2008 Share Posted May 13, 2008 Yes, read the links we posted above. Thats excellent - Thanks :-) Any ideas? Quote Link to comment Share on other sites More sharing options...
947740 Posted May 13, 2008 Share Posted May 13, 2008 I am assuming (even though I should not) that if you do not supply a timestamp, the date function automatically uses the current time? You could just do <?phpecho date("jS F y", strtotime("now"));?> , thusly removing the other line of code. Quote Link to comment Share on other sites More sharing options...
spires Posted May 13, 2008 Author Share Posted May 13, 2008 Cheers guys. Perfect. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted May 13, 2008 Share Posted May 13, 2008 I am assuming (even though I should not) that if you do not supply a timestamp, the date function automatically uses the current time? You are correct. Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given. In other words, timestamp is optional and defaults to the value of time(). So theoretically you could just say <?php echo date("jS F y"); ?> for the same effect as formatting the time right now. 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.