Converts float type to DateTime object. Uses in MSSQL, so you can make query
SELECT CAST(43243.5382623071 AS datetime) as human_time;
-- or
SELECT CAST(GETDATE() AS float) as float_time;
But without milliseconds yet
Float to DateTime
$converter = new MSSQLTimeConverter();
$MSDateTime = 43243.5382623071;
$humanDate = $converter->floatToDateTime($MSDateTime, 'Europe/Kiev');
echo $humanDate->format('Y-m-d H:i:s.u'); // 2018-05-25 12:55:05.000000
DateTime to Float
$timeNow = new DateTime('2018-05-25 12:55:05.000000', 'Europe/Kiev');
$converter = new MSSQLTimeConverter();
echo $converter->dateTimeToFloat($timeNow); // ~43243.5382623071
If you want to convert only time
$time = "12:55:05";
// You need to hardcore 1900-01-01. I hope it's temporary.
$dateTime = new DateTime("1900-01-01 " . $time, 'Europe/Kiev');
$converter = new MSSQLTimeConverter();
echo $converter->dateTimeToFloat($timeNow); // ~43243.5382623071
- take with milliseconds