Fix time calculation

MySQL uses seconds, but java uses milliseconds, so fix the input into
the date conversion function in Java.