Home    Reference > E Views > date
prev next

Description

View of string where the value represents a date and time. Internally dates are represented as 64 bit integers that are milliseconds after January 1, 1970 00:00:00 GMT. Externally dates are strings such as the following example.

2006/09/28 10:22:34.881 PDT

A date string consist of the following numeric parts. A numeric part may be omitted, but then all following numeric parts must also be omitted. If a numeric part is omitted the default value is the minimum permitted. There is no default value for year.

name separator value
year   "2006"
month "/" "09"
day "/" "28"
hour " " "10"
minute ":" "22"
second ":" "34"
millisecond "." "881"

This can optionally be followed by a time zone. The default for time zone is the local time zone.

name separator value
timezone " " "PDT"

Examples of how to use the date view can be found in the date example.

View date

@x:view date

@x:view @x:func sys:Is(v~boolean)~boolean
@x:view @x:func sys:Make(val~date,year=year1~int,month=month1~int,day=day1~int,hour=hour1~int,minute=minute1~int,second=second1~int,millisecond=millisecond1~int,timeZone=timeZone1~string)~date
@x:view @x:func now()~date
@x:view @x:func gmt()~date
@x:view @x:func sys:Sub(a~date,b~date)~int
@x:view @x:func sys:Eq(a~date,b~date)~boolean
@x:view @x:func sys:Ne(a~date,b~date)~boolean
@x:view @x:func sys:Less(a~date,b~date)~boolean
@x:view @x:func sys:LessEq(a~date,b~date)~boolean
@x:view @x:func sys:Greater(a~date,b~date)~boolean
@x:view @x:func sys:GreaterEq(a~date,b~date)~boolean
@x:self @x:const year~int
@x:self @x:const month~int
@x:self @x:const day~int
@x:self @x:const hour~int
@x:self @x:const minute~int
@x:self @x:const second~int
@x:self @x:const millisecond~int
@x:self @x:const dayOfWeek~int
@x:self @x:const dayOfYear~int
@x:self @x:const timeZone~string
@x:self @x:const timeZoneLong~string
@x:self @x:const dst~boolean
@x:self @x:func add(year=year1~int,month=month1~int,day=day1~int,hour=hour1~int,minute=minute1~int,second=second1~int,millisecond=millisecond1~int,timeZone=timeZone1~string)~date

View Function sys:Is

@x:func sys:Is(v~boolean)~boolean
v value to test

Semantics

The result is
true if val is a string that represents a date.

View Function sys:Make

@x:func sys:Make(val~date,year=year1~int,month=month1~int,day=day1~int,hour=hour1~int,minute=minute1~int,second=second1~int,millisecond=millisecond1~int,timeZone=timeZone1~string)~date
val (optional) a starting date value.
year=year1 (optional) a year.
month=month1 (optional) a month value (1..12).
day=day1 (optional) a day (1..31).
hour=hour1 (optional) an hour (0..23).
minute=minute1 (optional) a minute (0..59).
second=second1 (optional) a second (0..59).
millisecond=millisecond1 (optional) a millisecond value (0..999)
timeZone=timeZone1 (optional) a timezone.

Semantics

If val is present, it forms the initial value. If val is not present, year must be present and the initial value is formed from that year and default values for all other fields.

For each named parameter the initial value is modified for that field to the specified value. The overall result is the result of applying all these modifications to the initial value.


View Function now

@x:func now()~date

Semantics

The current date in the local timezone.

View Function gmt

@x:func gmt()~date

Semantics

The current date in GMT (Greenwich Mean Time).

View Function sys:Sub

@x:func sys:Sub(a~date,b~date)~int
a first parameter
b second parameter

Semantics

The result is the number of milliseconds that a is after b.

View Function sys:Eq

@x:func sys:Eq(a~date,b~date)~boolean
a first parameter
b second parameter

Semantics

If a and b have the same date value, then the result is
true, else the result is false.

View Function sys:Ne

@x:func sys:Ne(a~date,b~date)~boolean
a first parameter
b second parameter

Semantics

If a and b have the same date value, then the result is
false, else the result is true.

View Function sys:Less

@x:func sys:Less(a~date,b~date)~boolean
a first parameter
b second parameter

Semantics

If a is less than b, then the result is
true, else the result is false.

View Function sys:LessEq

@x:func sys:LessEq(a~date,b~date)~boolean
a first parameter
b second parameter

Semantics

If a is less than or equal to b, then the result is
true, else the result is false.

View Function sys:Greater

@x:func sys:Greater(a~date,b~date)~boolean
a first parameter
b second parameter

Semantics

If a is greater than b, then the result is
true, else the result is false.

View Function sys:GreaterEq

@x:func sys:GreaterEq(a~date,b~date)~boolean
a first parameter
b second parameter

Semantics

If a is greater than or equal to b, then the result is
true, else the result is false.

Self Const year

@x:const year~int

Semantics

The year part of the date.

Self Const month

@x:const month~int

Semantics

The month part of the date (1
..12.

Self Const day

@x:const day~int

Semantics

The day part of the date (1
..31.

Self Const hour

@x:const hour~int

Semantics

The hour part of the date (0
..23.

Self Const minute

@x:const minute~int

Semantics

The minute part of the date (0
..59.

Self Const second

@x:const second~int

Semantics

The second part of the date (0
..59.

Self Const millisecond

@x:const millisecond~int

Semantics

The millisecond part of the date (0
..999.

Self Const dayOfWeek

@x:const dayOfWeek~int

Semantics

The day of the week (0
..6. Sunday has value 0.

Self Const dayOfYear

@x:const dayOfYear~int

Semantics

The day of the year (1
..366. January 1 has value 1.

Self Const timeZone

@x:const timeZone~string

Semantics

The time zone part of the date.

Self Const timeZoneLong

@x:const timeZoneLong~string

Semantics

The long form of the time zone part of the date.

Self Const dst

@x:const dst~boolean

Semantics

If the date is in daylight savings time the result is
true.

Self Function add

@x:func add(year=year1~int,month=month1~int,day=day1~int,hour=hour1~int,minute=minute1~int,second=second1~int,millisecond=millisecond1~int,timeZone=timeZone1~string)~date
year=year1 (optional) a year delta.
month=month1 (optional) a month delta.
day=day1 (optional) a day delta.
hour=hour1 (optional) an hour delta.
minute=minute1 (optional) a minute delta.
second=second1 (optional) a second delta.
millisecond=millisecond1 (optional) a millisecond delta.
timeZone=timeZone1 (optional) a new timezone.

Semantics

The result starts with the self data and then applies any deltas or timezone changes and returns that new date.