- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
function dbtime2unix($dt)
{
$year = substr($dt,0,4);
$month = substr($dt,5,2);
$day = substr($dt,8,2);
$hour = substr($dt,11,2);
$minute = substr($dt,14,2);
$sec = substr($dt,17,2);
return @mktime($hour,$minute,$sec,$month,$day,$year);
}
function timestamp2unix($dt)
{
$year = substr($dt,0,4);
$month = substr($dt,4,2);
$day = substr($dt,6,2);
$hour = substr($dt,8,2);
$minute = substr($dt,10,2);
$sec = substr($dt,12,2);
return @mktime($hour,$minute,$sec,$month,$day,$year);
}
cheef 10.09.2009 16:52 # 0
denis 10.09.2009 17:00 # 0
-------------------------------------------
function timestamp2unix($dt) {
$year = substr($dt, 0, 4);
$month = substr($dt, 4, 2);
$day = substr($dt, 6, 2);
$hour = substr($dt, 8, 2);
$minute = substr($dt, 10, 2);
$sec = substr($dt, 12, 2);
return @mktime($hour, $minute, $sec, $month, $day, $year);
}
$expected = mktime(17, 53, 45, 09, 10, 2009);
$timestamp = "20090910175345";
echo "expected = $expected<br>";
echo "strtotime(\$timestamp) = ".strtotime($timestamp)."<br>";
echo "timestamp2unix(\$timestamp) = ".timestamp2unix($timestamp)."<br>";
---------------------------------------
expected = 1228920825
strtotime($timestamp) = -1
timestamp2unix($timestamp) = 1252590825
ЧЯДНТ?
TWINc 10.09.2009 22:30 # 0
guest 15.09.2009 13:42 # 0