PHP Classes

Incredible Timestamp: Compute the seconds elapsed since the year 0

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 111 This week: 1All time: 9,614 This week: 560Up
Version License PHP version Categories
m12 1.0.0Custom (specified...5PHP 5, Time and Date
Description 

Author

This class can compute the seconds elapsed since the year 0.

It takes as parameter an array of date and time elements that include the year, month, day, hour, minutes and seconds.

The class can convert the date and time values to the number of seconds since year 0 and since UNIX epoch of 1970.

Picture of zinsou A.A.E.Moïse
  Performance   Level  
Name: zinsou A.A.E.Moïse is available for providing paid consulting. Contact zinsou A.A.E.Moïse .
Classes: 50 packages by
Country: Benin Benin
Age: 34
All time rank: 6781 in Benin Benin
Week rank: 109 Up1 in Benin Benin Equal
Innovation award
Innovation award
Nominee: 23x

Winner: 2x

Example

<?php
require_once('./IncredibleTimestamp.class.php');
$t=time();
$c=new IncredibleTimestamp(explode('-',date("Y-m-d-H-i-s",$t)));
echo
'<br>'.$i=$c->IncTimestamp ();
echo
'<br>'.$c->IncTimestamptoUnix ();
echo
'<br>'.$t;

$c=new IncredibleTimestamp();
echo
'<br>'.$c->IncTimestamp ();
echo
'<br>'.$c->IncTimestamptoUnix ();

$c=new IncredibleTimestamp(explode("-","1970-01-01-00-00-00"));
echo
'<br>'.$c->IncTimestamp ();
echo
'<br>'.$c->IncTimestamptoUnix ();

?>
<br>I 'm sure you want to know how to reverse this , just take a look at my class DatefromInc which<br> will allow you
when you get an incredible timestamp to know its corresponding date<br> so you can use this system instead of
Unix timestamp because of limitation...<br>and the bug of year 2038...


Details

IncredibleTimestamp class is powerful class to compute the time in seconds elapsed from year 0 to any date and time of your choice,in other words since Jesus-christ birth as it is the starting point for our actual calendar to your chosen datetime. The package contains a method to convert unix timestamp to IncredibleTimestamp: UnixtoIncTimestamp($x) $x must be a numeric The class constructor: public function __construct($date=false){ $date must be a date and time formatted as array(year,month,day,hour,min,sec) example: array(2017,12,31,00,1,59); if your array is not full the class will complete it itself example: array(2017) will return always (2017,1,1,0,0,0); if your array has more than six elements the class will reduce it itself example: array(2017,1,1,0,0,0,2,5,7) will return always (2017,1,1,0,0,0); if you don't specify a date the class will automatically return the date and the time of the day if the day is before 19-01-2038 04:00:00 else it will return the 01-01-0000 00:00:00 } The class contains except the constructor, three methods: -Two getters: *public Inctimestamp() return the incredible timestamp *public IncTimestamptoUnix() convert the incredible timestamp to unix timestamp -and one setter *public Timestamp () compute the incredible timestamp and assign it to the protected property timestamp. See the testInc.php file for example of how to use. This script is too short to provide more documentation. Contact at leizmo@gmail.com

  Files folder image Files  
File Role Description
Plain text file IncredibleTimestamp.class.php Class class source
Accessible without login Plain text file license.txt Lic. license
Accessible without login Plain text file readme.txt Doc. readme
Accessible without login Plain text file testIncr.php Example example script

 Version Control Reuses Unique User Downloads Download Rankings  
 0%2
Total:111
This week:1
All time:9,614
This week:560Up