diff options
author | 2013-12-05 11:36:46 -0500 | |
---|---|---|
committer | 2013-12-05 11:36:46 -0500 | |
commit | 3e814081cc04b2048a8f882a832890cc39332d79 (patch) | |
tree | 9e31f41a597508da5950b1f4869d8ca7acc864e0 /lib/ur/datetime.ur | |
parent | a7d5aa431c2e02652ca15dacce4b7f81268eeb85 (diff) |
Basic datetime library.
Diffstat (limited to 'lib/ur/datetime.ur')
-rw-r--r-- | lib/ur/datetime.ur | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/ur/datetime.ur b/lib/ur/datetime.ur new file mode 100644 index 00000000..56c29724 --- /dev/null +++ b/lib/ur/datetime.ur @@ -0,0 +1,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) |