there is a standard SI unit βsecondβ that you can use to represent time. You will need to specify the FSharp.PowerPack.dll file, and then you can use the following:
open Microsoft.FSharp.Math
let minute = 60<SI.s>
let twoMinutes = minute * 2
There are no built-in units in minutes / hours, etc., since they are not standard units (and in fact only seconds are multiplied by a certain amount). However, you can also determine the minutes if you want:
[<Measure>]
type mins =
static member of_seconds(sec) = sec / 60<SI.s> * 1<mins>
let timeInMinuts = mins.of_seconds(twoMinutes)
System.DateTime, , , (/) , :
open System
type DateTimeUnits(dt:DateTime) =
static member Now = new DateTimeUnits(DateTime.Now)
member x.Second = dt.Second * 1<SI.s>
member x.Minute = dt.Minute * 1<mins>