- 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
function timeToSec($date){
$timeToSec = 0;
$month_to_days = array(1=>0,2=>31,3=>59,4=>90,5=>90,6=>151,7=>181,8=>212,9=>243,10=>273,11=>304,12=>334);
$year = intval(substr($date, 0, 4));
$month = intval(substr($date, 5, 2));
$day = intval(substr($date, 8, 2));
$hover = intval(substr($date, 11, 2));
$minute = intval(substr($date, 14, 2));
$second = intval(substr($date, 17, 2));
$timeToSec+= ($year-1 - ($year-1)%4)/4 * 24 * 60 * 60 + ($year-1) * 355 * 24 * 60 * 60;
$timeToSec+= $month_to_days[$month] * 24 * 60 * 60;
if($year%4==0 && $month>2){
$timeToSec+= 24 * 60 * 60;
}
$timeToSec+= ($day-1) * 24 * 60 * 60;
$timeToSec+= $hover * 60 * 60;
$timeToSec+= $minute * 60;
$timeToSec+= $second;
return $timeToSec;
}
Комментарии (0) RSS
Добавить комментарий