In my MySQL database I have one column (text) with about 2000 rows. In each row I have a Julian date (like 2457268 for 2015-09-02).
Looking for a solution to update all rows from Julian to Gregorian.
Any way to do this in either SQL or PHP?
In my MySQL database I have one column (text) with about 2000 rows. In each row I have a Julian date (like 2457268 for 2015-09-02).
Looking for a solution to update all rows from Julian to Gregorian.
Any way to do this in either SQL or PHP?
Have you looked at jdtogregorian()
in PHP?
staaland originally posted this answer within their question (in this revision) instead of creating an answer post.
I found the solution myself:
$strSQL = "SELECT * FROM tabel"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); while($objResult = mysql_fetch_array($objQuery)) { $dbDate = $objResult["field1"]; $id = $objResult["id"]; $date = jd_to_greg($dbDate); mysql_query("UPDATE tabel SET `column1` = '$date' WHERE id=$id"); }