summaryrefslogtreecommitdiff
path: root/lib/ur/datetime.ur
blob: 56c2972429d36624adcffd9c3abd9755ca0d6839 (plain)
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
type datetime = {
     Year : int,
     Month : int,
     Day : int,
     Hour : int,
     Minute : int,
     Second : int
}

fun toTime dt : time = fromDatetime dt.Year dt.Month dt.Day
                                    dt.Hour dt.Minute dt.Second

fun fromTime t : datetime = {
    Year = datetimeYear t,
    Month = datetimeMonth t,
    Day = datetimeDay t,
    Hour = datetimeHour t,
    Minute = datetimeMinute t,
    Second = datetimeSecond t
}

fun datetimef fmt dt : string = timef fmt (toTime dt)

val now : transaction datetime =
    n <- now;
    return (fromTime n)