PHP Classes

PHP Day Light Calculator: Calculate the day hours for a given location

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 185 This week: 1All time: 8,645 This week: 560Up
Version License PHP version Categories
day-light 1.0.0Freeware5PHP 5, Time and Date, Geography
Description 

Author

This class can calculate the day hours for a given location.

It can take the latitude and longitude of a location and the time zone and it can calculate several types of time values. Currently it can return:

- The current time of the day
- The Sunrise and Sunset time
- The duration of the period with Sun light
- The remaining number of Sun light left for the day
- The duration of the period without Sun light
- The remaining number without Sun light left for the day
- Data for an image that can be the Sun or Moon images depending whether it is day or night

In Spanish:

Esta clase calcula las horas de luz y de obscuridad del dia asi como las horas de puesta y salida del sol pasando como parámetro las coordenadas geograficas y el uso horario(timezone). Tambien muestra una imagen con el sol o la luna si es de dia o de noche.

Innovation Award
PHP Programming Innovation award nominee
January 2020
Number 4
Many activities can only happen during the period of the day when there is light coming from the Sun. An example of that kind of activity can be for instance going to a beach to receive sunlight baths.

This class can calculate the number of hours of sunlight for a given location.

This way, users of a PHP application that uses this class may be aware of the length of the period of the day that they can use to benefit from the Sun Light.

Manuel Lemos
Picture of Dannel
  Performance   Level  
Name: Dannel <contact>
Classes: 9 packages by
Country: Cuba Cuba
Age: 30
All time rank: 30438 in Cuba Cuba
Week rank: 411 Up1 in Cuba Cuba Up
Innovation award
Innovation award
Nominee: 5x

Example

<?php
include 'php_light_time_calculator.php';
$obj=new LightnShade;
$a=$obj->dayLight(22.9666666666667,-82.15,"America/New_York");
?>
<?=
'Current time: '.$a['now']?> <br>
<?='Sunrise today: '.$a['sunrise']?> <br>
<?='Sunset today: '.$a['sunset']?> <br>
<?='Hours of Light: '.$a['lightHours']?> <br>
<?='Remaining Hours of Light : '.$a['lightHoursLeft']?> <br>
<?='Hours of Dark: '.$a['darkHours']?> <br>
<?='Remaining Hours of Dark : '.$a['darkHoursLeft']?> <br>
<?='Star Above our heads: <br>'.$a['Star']?> <br>


  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example script
Plain text file php_light_time_calculator.php Class Class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:185
This week:1
All time:8,645
This week:560Up