Skip to content

Instantly share code, notes, and snippets.

View sandyarmstrong's full-sized avatar

Sandy Armstrong sandyarmstrong

View GitHub Profile
<?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)