public static function LocalDate2OLE($date = null)
	{
		if (!isset($date)) {
			return "\x00\x00\x00\x00\x00\x00\x00\x00";
		}

		// factor used for separating numbers into 4 bytes parts
		$factor = pow(2, 32);

		// days from 1-1-1601 until the beggining of UNIX era
		$days = 134774;
		// calculate seconds
		$big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
											 date("m",$date),date("d",$date),date("Y",$date));
		// multiply just to make MS happy
		$big_date *= 10000000;

		$high_part = floor($big_date / $factor);
		// lower 4 bytes
		$low_part = floor((($big_date / $factor) - $high_part) * $factor);

		// Make HEX string
		$res = '';

		for ($i = 0; $i < 4; ++$i) {
			$hex = $low_part % 0x100;
			$res .= pack('c', $hex);
			$low_part /= 0x100;
		}
		for ($i = 0; $i < 4; ++$i) {
			$hex = $high_part % 0x100;
			$res .= pack('c', $hex);
			$high_part /= 0x100;
		}
		return $res;
	}
public static function LocalDate2OLE($date = null)
	{
		if (!isset($date)) {
			return "\x00\x00\x00\x00\x00\x00\x00\x00";
		}

		// factor used for separating numbers into 4 bytes parts
		$factor = pow(2, 32);

		// days from 1-1-1601 until the beggining of UNIX era
		$days = 134774;
		// calculate seconds
		$big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
											 date("m",$date),date("d",$date),date("Y",$date));
		// multiply just to make MS happy
		$big_date *= 10000000;

		$high_part = floor($big_date / $factor);
		// lower 4 bytes
		$low_part = floor((($big_date / $factor) - $high_part) * $factor);

		// Make HEX string
		$res = '';

		for ($i = 0; $i < 4; ++$i) {
			$hex = $low_part % 0x100;
			$res .= pack('c', $hex);
			$low_part /= 0x100;
		}
		for ($i = 0; $i < 4; ++$i) {
			$hex = $high_part % 0x100;
			$res .= pack('c', $hex);
			$high_part /= 0x100;
		}
		return $res;
	}
public static function LocalDate2OLE ( $ date = null ) { if ( ! isset ( $ date ) ) { return "\x00\x00\x00\x00\x00\x00\x00\x00" ; } // factor used for separating numbers into 4 bytes parts $ factor = pow ( 2 , 32 ) ; // days from 1-1-1601 until the beggining of UNIX era $ days = 134774 ; // calculate seconds $ big_date = $ days * 24 * 3600 + gmmktime ( date ( "H" , $ date ) , date ( "i" , $ date ) , date ( "s" , $ date ) , date ( "m" , $ date ) , date ( "d" , $ date ) , date ( "Y" , $ date ) ) ; // multiply just to make MS happy $ big_date *= 10000000 ; $ high_part = floor ( $ big_date / $ factor ) ; // lower 4 bytes $ low_part = floor ( ( ( $ big_date / $ factor ) - $ high_part ) * $ factor ) ; // Make HEX string $ res = '' ; for ( $ i = 0 ; $ i < 4 ; ++ $ i ) { $ hex = $ low_part % 0x100 ; $ res .= pack ( 'c' , $ hex ) ; $ low_part /= 0x100 ; } for ( $ i = 0 ; $ i < 4 ; ++ $ i ) { $ hex = $ high_part % 0x100 ; $ res .= pack ( 'c' , $ hex ) ; $ high_part /= 0x100 ; } return $ res ; }
Utility function
Returns a string for the OLE container with the date given

@access public
@static
@param integer $date A timestamp
@return string The string for the OLE container
Utility function Returns a string for the OLE container with the date given