You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

There also exist algebraic operators (+,  -) to add or subtract dates.

Year(<Date>|<String,Pattern>)

Extracts the year part of the date

Example
SELECT YEAR("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 2013

Month(<Date>|<String,Pattern>)

Extracts the month part of the date

Example
SELECT MONTH("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 12

Week(<Date>|<String,Pattern>)

Returns the week number of the date

Example
SELECT WEEK("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 52

Day(<Date>|<String,Pattern>)

Extracts the day part of the date

Example
SELECT DAY("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 24

Hour(<Date>|<String,Pattern>)

Returns the hour of the date

Example
SELECT HOUR("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 5

Minute(<Date>|<String,Pattern>)

Returns the minute of the date

Example
SELECT MINUTE("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 30

Second(<Date>|<String,Pattern>)

Returns the second of the date

Example
SELECT SECOND("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 10

WeekDay(<Date>|<String,Pattern>)

Returns the week day index of the date (1 = Sunday, 2 = Monday, ..., 7 = Saturday)

Example
SELECT WEEKDAY("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 3

DayOfMonth(<Date>|<String,Pattern>)

Synonym for day().

Example
SELECT DAYOFMONTH("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 24

Years(Date, Date)

Computes the number of years between the two dates.

Months(Date, Date)

Computes the number of months between the two dates.

Days(Date, Date)

Computes the number of days between the two dates.

Hours(Date, Date)

Computes the number of hours between the two dates.

Minutes(Date, Date)

Computes the number of minutes between the two dates.

Seconds(Date, Date)

Computes the number of seconds between the two dates.

CurDate()

Return the current system time specific date

Now()

Returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC

NanoTime()

Returns the current value of the time source, in nanoseconds.

SysDate()

Returns the current system time specific date

StreamDate()

Returns the current stream time specific date

  • No labels