- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
$sec_in_year = 31536000;
$sec_in_lyear = 31622400;
$sec_in_28 = 2419200;
$sec_in_29 = 2505600;
$sec_in_30 = 2592000;
$sec_in_31 = 2678400;
$sec_in_day = 86400;
$sec_in_hour = 3600;
$sec_in_min = 60;
$year_count = 1970;
$month_count = 0;
$day_count = 1;
$hour_count = 0;
$min_count = 0;
$lyear_count = 2; // Make an array of seconds per month for ease of use.
$months = array(2678400, 2419200, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, 2678400);
$lmonths = array(2678400, 2505600, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, 2678400);
$month_list = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
while($utime >= $sec_in_year) { // Count the year since 1970.
if($lyear_count % 4 == 0) {
$utime -= $sec_in_lyear; // Compensate for leap years.
}
else {
$utime -= $sec_in_year;
}
$year_count++;
$lyear_count++;
}
while($utime >= $months[$month_count]) { // Count the months since Jan.
if($lyear_count % 4 == 0) {
$utime -= $lmonths[$month_count]; // Compensate for leap year Feb.
}
else {
$utime -= $months[$month_count];
}
$month_count++;
}
И еще куча строк кода.
Конвертим никсовый временной штамп, в читаемый для человека формат... aka date()