QBDatetimeColumn

Overview

The QBDatetimeColumn class represents a datetime column in a QBSelect query.

For more information about constructing and executing queries and columns, refer to the QBSelect section of this documentation.

Extends

QBColumn

Properties Summarized

Type
Name
Summary

Extract day from date

Extract hour from date

Compare column with null.

Create an aggregate max expression.

Create an aggregate min expression.

Extract minute from date

Extract month from date

Create a negated condition.

Extract second from date

Extract year from date

Methods Summarized

Type
Name
Summary

Compare column to a range of 2 values or other columns.

Create coalesce(arg) expression

Compare column with a value or another column.

Compare column with a value or another column.

Compare column with a value or another column.

Compare column with subquery result.

Compare column with values.

Compare column with custom query result.

Compare column with a value or another column.

Compare column with a value or another column.

Create nullif(arg) expression

Properties Detailed

day

Extract day from date

Type QBColumn a QBIntegerColumn representing the extraction of the day from a date.

Sample

query.result.add(query.columns.mydatecol.day)

hour

Extract hour from date

Type QBColumn a QBIntegerColumn representing the extraction of the hour from a date.

Sample

query.result.add(query.columns.mydatecol.hour)

isNull

Compare column with null.

Type QBCondition a QBCondition representing the "is null" comparison.

Sample

query.where.add(query.columns.flag.isNull)

max

Create an aggregate max expression.

Type QBColumn a QBColumn representing the sum aggregate function.

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.groupBy.addPk() // have to group by on pk when using having-conditions in (foundset) pk queries
	.root.having.add(query.joins.orders_to_order_details.columns.quantity.count.max(10))
	foundset.loadRecords(query)

min

Create an aggregate min expression.

Type QBColumn a QBColumn representing the minimum aggregate function.

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.groupBy.addPk() // have to group by on pk when using having-conditions in (foundset) pk queries
	.root.having.add(query.joins.orders_to_order_details.columns.quantity.count.min(10))
	foundset.loadRecords(query)

minute

Extract minute from date

Type QBColumn a QBIntegerColumn representing the extraction of the minute from a date.

Sample

query.result.add(query.columns.mydatecol.minute)

month

Extract month from date

Type QBColumn a QBIntegerColumn representing the extraction of the month from a date.

Sample

query.result.add(query.columns.mydatecol.month)

not

Create a negated condition.

Type QBColumnComparable a QBColumn representing the negated condition.

Sample

query.where.add(query.columns.flag.not.eq(1))

second

Extract second from date

Type QBColumn a QBIntegerColumn representing the extraction of the second from a date.

Sample

query.result.add(query.columns.mydatecol.second)

year

Extract year from date

Type QBColumn a QBIntegerColumn representing the extraction of the year from a date.

Sample

query.result.add(query.columns.mydatecol.year)

Methods Detailed

between(value1, value2)

Compare column to a range of 2 values or other columns.

Parameters

Returns: QBCondition a QBCondition representing the "between" comparison for the two values.

Sample

query.where.add(query.columns.flag.between(0, 5))

coalesce(value)

Create coalesce(arg) expression

Parameters

  • Object value when column is null

Returns: QBColumn a QBColumn representing the coalesce expression.

Sample

query.result.add(query.columns.mycol.coalesce('defval'))

eq(value)

Compare column with a value or another column. Operator: equals

Parameters

Returns: QBCondition a QBCondition representing the "equals" comparison.

Sample

query.where.add(query.columns.flag.eq(1))

ge(value)

Compare column with a value or another column. Operator: greaterThanOrEqual

Parameters

Returns: QBCondition a QBCondition representing the "greater than or equal to" comparison.

Sample

query.where.add(query.columns.flag.ge(2))

gt(value)

Compare column with a value or another column. Operator: greaterThan

Parameters

Returns: QBCondition a QBCondition representing the "greater than" comparison.

Sample

query.where.add(query.columns.flag.gt(0))

isin(query)

Compare column with subquery result.

Parameters

Returns: QBCondition a QBCondition representing the "in" comparison with a subquery.

Sample

query.where.add(query.columns.flag.isin(query2))

isin(values)

Compare column with values.

Parameters

  • Array values array of values

Returns: QBCondition a QBCondition representing the "in" comparison with a list of values.

Sample

query.where.add(query.columns.flag.isin([1, 5, 99]))

isin(customQuery, args)

Compare column with custom query result.

Parameters

  • String customQuery custom query

  • Array args query arguments

Returns: QBCondition a QBCondition representing the "in" comparison with a custom query and arguments.

Sample

query.where.add(query.columns.ccy.isin("select ccycode from currencies c where c.category = " + query.getTableAlias() + ".currency_category and c.flag = ?", ['T']))

le(value)

Compare column with a value or another column. Operator: lessThanOrEqual

Parameters

Returns: QBCondition a QBCondition representing the "less than or equal to" comparison.

Sample

query.where.add(query.columns.flag.le(2))

lt(value)

Compare column with a value or another column. Operator: lessThan

Parameters

Returns: QBCondition a QBCondition representing the "less than" comparison.

Sample

query.where.add(query.columns.flag.lt(99))

nullif(arg)

Create nullif(arg) expression

Parameters

Returns: QBColumn a QBColumn representing the nullif expression.

Sample

query.result.add(query.columns.mycol.nullif('none'))

Last updated

Was this helpful?