/ Published in: PHP
This takes a date like so: Sat, 08 Jan 2011 from a database and allows you to use it in your code. For example if you wanted to work out a week from Sat, 08 Jan 2011 it can be done with ease. I created this for a project i am currently working on. There maybe an easier way to deal with this problem but its works so enjoy!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function scheduleGameForNextWeek($date) { switch($month) { case "jan": $month = "01"; break; case "feb": $month = "02"; break; case "mar": $month = "03"; break; case "apr": $month = "04"; break; case "may": $month = "05"; break; case "jun": $month = "06"; break; case "jul": $month = "07"; break; case "aug": $month = "08"; break; case "sep": $month = "09"; break; case "oct": $month = "10"; break; case "nov": $month = "11"; break; case "dec": $month = "12"; break; default: $month = "00"; break; } } $date = "Sun, 9 Jan 2011"; echo $newDate = scheduleGameForNextWeek($date); ?>