Created
October 11, 2013 08:02
-
-
Save sebastianwagner/6931211 to your computer and use it in GitHub Desktop.
Converts Timestamp from LotusNotes format into Unix one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const LOTUS_TIME_FORMAT = '%Y%m%dT%H%M%S,'; | |
function lotusTime2UnixTime($srcValue){ | |
//Example 20110413T084135,95+02 | |
/* in PHP5.3 | |
$time = new DateTime(); | |
$time->createFromFormat('Ymd\THis,uO', $srcValue); | |
$dstValue = intval($time->format('U')); */ | |
$t = strptime($srcValue, LOTUS_TIME_FORMAT); | |
$retval = mktime($t['tm_hour'],$t['tm_min'],$t['tm_sec'], | |
$t['tm_mon']+1,$t['tm_mday']+1,$t['tm_year']+1900); | |
if($retval == False) $retval = 0; | |
return $retval; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment