Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function GetPregnancyWeekString($start_date_str)
- {
- $current_week_num = floor((strtotime("now") - strtotime($start_date_str))/60/60/24/7)+1;
- $suffix = "th";
- if ($current_week_num%10 == 1)
- $suffix = "st";
- else if ($current_week_num%10 == 2)
- $suffix = "nd";
- else if ($current_week_num%10 == 3)
- $suffix = "rd";
- return "<span class=\"week_num\">$current_week_num</span>$suffix";
- }
- ?>
- <div class="week_box">We're in our <?php print GetPregnancyWeekString("08/01/2009");?> week!</div>
Add Comment
Please, Sign In to add comment