Module
Data.DateTime.Instant
- Package
- purescript-datetime
- Repository
- purescript/purescript-datetime
#instant Source
instant :: Milliseconds -> Maybe Instant
Attempts to create an Instant
from a Milliseconds
duration. The
minimum acceptable value equates to the bottom
DateTime
and the maximum
acceptable value equates to the top
DateTime
.
#unInstant Source
unInstant :: Instant -> Milliseconds
Lowers an Instant
to a Milliseconds
duration.
#fromDateTime Source
fromDateTime :: DateTime -> Instant
Creates an Instant
from a DateTime
value.
#toDateTime Source
toDateTime :: Instant -> DateTime
Creates a DateTime
value from an Instant
.
#diff Source
diff :: forall d. Duration d => Instant -> Instant -> d
Calculates the difference between two instants, returning the result as a duration. For example:
do
start <- liftEffect Now.now
aLongRunningAff
end <- liftEffect Now.now
let
hours :: Duration.Hours
hours = Instant.diff end start
log ("A long running Aff took " <> show hours)
- Modules
- Data.
Date - Data.
Date. Component - Data.
Date. Component. Gen - Data.
Date. Gen - Data.
DateTime - Data.
DateTime. Gen - Data.
DateTime. Instant - Data.
Interval - Data.
Interval. Duration - Data.
Interval. Duration. Iso - Data.
Time - Data.
Time. Component - Data.
Time. Component. Gen - Data.
Time. Duration - Data.
Time. Duration. Gen - Data.
Time. Gen