Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Created September 4, 2013 17:14
Show Gist options
  • Save wizardishungry/6439938 to your computer and use it in GitHub Desktop.
Save wizardishungry/6439938 to your computer and use it in GitHub Desktop.
sunrise sunset calculations for the north pole are surprising
<?php
date_default_timezone_set('GMT');
$tim = strtotime("December 21");
$fmt = SUNFUNCS_RET_STRING;
$lat = 90;
$lng = 0;
for($i = 0; $i<182; $i++) {
echo date(DATE_RFC822, $tim), "\t",
date_sunrise($tim, $fmt, $lat, $lng), " ",
date_sunset($tim, $fmt, $lat, $lng), "\n";
$tim = strtotime("+1 day", $tim);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment