Microsoft Access/SQL Server Date Formating

Asked by Juma Lungo on 2013-05-01

How to format date values extracted from MS Access/SQL Server database? They are formatted strangely as time and when converted, they become 5 digit figure!

Question information

Language:
English Edit question
Status:
Solved
For:
ihris-manage-malawi Edit question
Assignee:
Juma Lungo Edit question
Solved by:
Juma Lungo
Solved:
2013-05-01
Last query:
2013-05-01
Last reply:
Juma Lungo (jlungo) said : #1

Well, after any hour of googling i found the solution!. This pieace of code here solved my mythical bug!

<?php
        $date = new DateTime('2006-12-12');
        $date->modify('+1 day');
        echo $date->format('Y-m-d');
?>

see detailed explanation here: http://stackoverflow.com/questions/9294302/add-a-duration-to-a-date-by-dateinterval

To adapt the code, i know Mr. Microsoft's date when are in 5 digits, it means how many days since "1899-12-31". So, i just added the 5 digit figure to this date, then waoh!

I can import data from SQL Server database to iHRIS straight away.

gnt!

Juma Lungo (jlungo) said : #2

done