Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read date/time in an sqlite data base file
#3
I could be wrong but it appears that its Julian Date
I happen to have a c# conversion function for that. if it's not ignore this post.
if it is Julian date try this
Code:
Copy      Help
str s="2459067.10928241"
str dt
dt=sub.JulianDateToDateTimeString(s)
out dt
DateTime dt1.FromStr(dt)
out dt.timeformat("{dd-MM-yyyy}" dt1)
out dt.timeformat("{hh:mm:ss}" dt1)

#sub JulianDateToDateTimeString
function~ ~jds
DECIMAL jd
jd=jds
CsScript x
x.AddCode("")
str R=x.Call("JulianToDateTime" jd)
ret R



#ret
//C# code
using System;

public class Class1
{
,public static DateTime JulianToDateTime(double julianDate)
,{
,,double unixTime = (julianDate - 2440587.5) * 86400;
,,DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
,,dtDateTime = dtDateTime.AddSeconds(unixTime).ToLocalTime();
,,return dtDateTime;
,}
}

with this function 2459067.10928241
converts to 8/5/2020 10:37:22 AM on my pc


Messages In This Thread
RE: Read date/time in an sqlite data base file - by Kevin - 08-06-2020, 04:38 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)