phppaper Posted October 27, 2010 Share Posted October 27, 2010 How can I get the day of the week from DD/MM/YYYY?? Thanks! Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/ 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)); Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126955 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?? Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126957 Share on other sites More sharing options...
BlueSkyIS Posted October 27, 2010 Share Posted October 27, 2010 strange, i get Wednesday Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126960 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. Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126961 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?? Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126962 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?? Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126963 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? Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126965 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? Link to comment https://forums.phpfreaks.com/topic/216958-get-weekday-from-ddmmyyyy/#findComment-1126966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.