Skip to content

Instantly share code, notes, and snippets.

@sebastianwagner
Created October 11, 2013 08:02
Show Gist options
  • Save sebastianwagner/6931211 to your computer and use it in GitHub Desktop.
Save sebastianwagner/6931211 to your computer and use it in GitHub Desktop.
Converts Timestamp from LotusNotes format into Unix one
<?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