Skip to content

minube/solar-position

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Solar Position

Calculate the sunset and sunrise times for a particular location and date, as well as the different twilight phases (civil, nautical, astronomical) times. More details about the different sun position phases in timeanddate.com.

Input

  • Date: array('day', 'month', 'year')
  • Latitude
  • Longitude

Output

Example

    use SolarPosition\Calculator;

    $latitude = 40.433202;
    $longitude = -3.690161;
    $date = array('day'=>23, 'month'=>6, 'year'=>2017);

    $sun = new Calculator();
    $sunsetTime = $sun->getSunset($date, $latitude,$longitude);
    /*
        DateTime Object
        (
            [date] => 2017-06-23 19:48:35
            [timezone_type] => 3
            [timezone] => UTC
        )
    */