phppaper Posted October 27, 2010 Share Posted October 27, 2010 How can I get the day of the week from DD/MM/YYYY?? Thanks! Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 27, 2010 Share Posted October 27, 2010 $date = 'DD/MM/YYYY'; echo date(l, strtotime($date)); Quote Link to comment Share on other sites More sharing options...
phppaper Posted October 27, 2010 Author Share Posted October 27, 2010 $date = 'DD/MM/YYYY'; echo date(l, strtotime($date)); Hey thx but how come I input: $date = '27/10/2010'; echo date(l, strtotime($date)); but it shows up Saturday?? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted October 27, 2010 Share Posted October 27, 2010 strange, i get Wednesday Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 27, 2010 Share Posted October 27, 2010 Just looked at the manual and it seems that it needs the string to be in a US english format, so 10/27/2010 will be fine, as would 27 OCT 2010, but 27/10/2010 is not. I had forgotten about that, sorry. Quote Link to comment Share on other sites More sharing options...
phppaper Posted October 27, 2010 Author Share Posted October 27, 2010 I am using PHP 4 , is it what it causes the error?? Quote Link to comment Share on other sites More sharing options...
phppaper Posted October 27, 2010 Author Share Posted October 27, 2010 Just looked at the manual and it seems that it needs the string to be in a US english format, so 10/27/2010 will be fine, as would 27 OCT 2010, but 27/10/2010 is not. Just looked at the manual and it seems that it needs the string to be in a US english format, so 10/27/2010 will be fine, as would 27 OCT 2010, but 27/10/2010 is not. I had forgotten about that, sorry. Thanks, yes you are right, only US format supported. Do you know any other way to solve the issue with non US format?? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 27, 2010 Share Posted October 27, 2010 You could convert the values to US format before using them in strtotime() if they're all stored as DD/MM/YYYY. These dates aren't coming from a database query by chance, are they? Quote Link to comment Share on other sites More sharing options...
phppaper Posted October 27, 2010 Author Share Posted October 27, 2010 You could convert the values to US format before using them in strtotime() if they're all stored as DD/MM/YYYY. These dates aren't coming from a database query by chance, are they? Well the date are stored in the MySQL as datetime format, so the method you have shown will need to do some operation. No chance for another method? 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.