-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUTCModDate.txt
More file actions
66 lines (43 loc) · 2.01 KB
/
UTCModDate.txt
File metadata and controls
66 lines (43 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
## Modification Timestamp : UTCModeDate
included as a column in most (all ?) tables
uses SQlite function julianday with argument 'now' to generate a timestamp in the UTC JulianDay format. This is not what RM uses, however.
RM subtracts an offset:
julianday('now') - 2415018.5
This generates a "modified Julian Date'
Modified Julian Date means there is an offset subtracted from the standard Julian Date number.
Usually, this offset is: 2400000.5 but RM uses Microsoft's offset: 2415018.5
see:
[UTCModDate.txt](https://github.com/ricko2001/RootsMagic_Database_Design/blob/main/UTCModDate.txt)\
<https://en.wikipedia.org/wiki/Julian_day>\
<https://answers.microsoft.com/en-us/msoffice/forum/all/julian-date/7d23f252-272a-4e52-802e-ec3f3e616845>
<https://answers.microsoft.com/en-us/msoffice/forum/all/julian-date/7d23f252-272a-4e52-802e-ec3f3e616845>
Microsoft uses days since Dec20 1899.
Julian date is from
offset start point name
0 noon January 1, 4713 BC Original Julian Date. No controversy.
2400000.5 midnight Nov. 17 1858 more standard Modified JD offset
2415018.5 midnight Dec. 30, 1899 Microsoft MJD offset
2430000.0 midnight Jan. 5, 1941 some astrophysicists use this
https://stackoverflow.com/questions/5248827/convert-datetime-to-julian-date-in-c-sharp-tooadate-safe
SQLite docs
https://www.sqlite.org/lang_datefunc.html
using SQLite-
``` SQL
-- to generate current UTCModDate
SELECT julianday('now') - 2415018.5 AS UTCModDate
-- to convert UTCModDate to standard format UTC date/time
SELECT UTCModDate,
DATE(UTCModDate + 2415018.5) AS Date,
TIME(UTCModDate + 2415018.5) AS Time,
DATETIME(UTCModDate + 2415018.5) AS DateTime
FROM EventTable
-- Update the UTCModDate to the current time stamp:
UPDATE SourceTable
SET UTCModDate = julianday('now') - 2415018.5;
-- Select and convert UTCModDate to standard format UTC
SELECT datetime(UTCModDate + 2415018.5)
FROM SourceTable ;
-- or to local time:
SELECT datetime(UTCModDate + 2415018.5, 'localtime')
FROM SourceTable ;
```