rethinkdb-2.2.0.0: A driver for RethinkDB 2.1

Safe HaskellNone
LanguageHaskell98

Database.RethinkDB.Time

Synopsis

Documentation

>>> :set -XOverloadedStrings
>>> :load Database.RethinkDB.NoClash
>>> import qualified Database.RethinkDB as R
>>> import Database.RethinkDB.NoClash
>>> import Prelude
>>> h <- connect "localhost" 28015 def

now :: ReQL Source

The time and date when the query is executed

>>> run' h $ now

time :: ReQL -> ReQL -> ReQL -> ReQL -> ReQL -> ReQL -> ReQL -> ReQL Source

Build a time object from the year, month, day, hour, minute, second and timezone fields

>>> run' h $ time 2011 12 24 23 59 59 "Z"
Time<2011-12-24 23:59:59 +0000>

epochTime :: ReQL -> ReQL Source

Build a time object given the number of seconds since the unix epoch

>>> run' h $ epochTime 1147162826
Time<2006-05-09 08:20:26 +0000>

iso8601 :: ReQL -> ReQL Source

Build a time object given an iso8601 string

>>> run' h $ iso8601 "2012-01-07T08:34:00-0700"
Time<2012-01-07 08:34:00 -0700>

inTimezone :: Expr time => ReQL -> time -> ReQL Source

The same time in a different timezone

>>> _ <- run' h $ inTimezone "+0800" now

during :: (Expr left, Expr right, Expr time) => Bound left -> Bound right -> time -> ReQL Source

Test if a time is between two other times

>>> run' h $ during (Open $ now R.- (60*60)) (Closed now) $ epochTime 1382919271
false

timezone :: Expr time => time -> ReQL Source

Extract part of a time value

date :: Expr time => time -> ReQL Source

Extract part of a time value

timeOfDay :: Expr time => time -> ReQL Source

Extract part of a time value

year :: Expr time => time -> ReQL Source

Extract part of a time value

month :: Expr time => time -> ReQL Source

Extract part of a time value

day :: Expr time => time -> ReQL Source

Extract part of a time value

dayOfWeek :: Expr time => time -> ReQL Source

Extract part of a time value

dayOfYear :: Expr time => time -> ReQL Source

Extract part of a time value

hours :: Expr time => time -> ReQL Source

Extract part of a time value

minutes :: Expr time => time -> ReQL Source

Extract part of a time value

seconds :: Expr time => time -> ReQL Source

Extract part of a time value

toIso8601 :: Expr t => t -> ReQL Source

Convert a time to another representation

toEpochTime :: Expr t => t -> ReQL Source

Convert a time to another representation