Date
The date column represents a specific date (and potentially time).
Our API fully supports the date column, so you can read, update, and clear it via the API. You can also filter your items_page
query results by the date column.
Filtering the date column
Using the items_page
object, you can easily filter a board's items by specific columns or column values. The table below contains the date column's supported operators and compare values.
Operators | Compare value |
---|---|
any_of | "2023-07-01" )"TODAY" , "TOMORROW" , "YESTERDAY" , "THIS_WEEK" , "ONE_WEEK_AGO" , "ONE_WEEK_FROM_NOW" , "THIS_MONTH" , "ONE_MONTH_AGO" , "ONE_MONTH_FROM_NOW" , "PAST_DATETIME" , "FUTURE_DATETIME" , "UPCOMING" , "OVERDUE" , "DONE_ON_TIME" , "DONE_OVERDUE" , "$$$blank$$$" |
not_any_of | "2023-07-01" )"TODAY" , "TOMORROW" , "YESTERDAY" , "THIS_WEEK" , "ONE_WEEK_AGO" , "ONE_WEEK_FROM_NOW" , "THIS_MONTH" , "ONE_MONTH_AGO" , "ONE_MONTH_FROM_NOW" , "PAST_DATETIME" , "FUTURE_DATETIME" , "UPCOMING" , "OVERDUE" , "DONE_ON_TIME" , "DONE_OVERDUE" , "$$$blank$$$" |
is_empty | null |
is_not_empty | null |
greater_than | "TODAY" , "TOMORROW" , "YESTERDAY" , "THIS_WEEK" , "ONE_WEEK_AGO" , "ONE_WEEK_FROM_NOW" , "THIS_MONTH" , "ONE_MONTH_AGO" , "ONE_MONTH_FROM_NOW" , "PAST_DATETIME" , "FUTURE_DATETIME" , "UPCOMING" , "OVERDUE" , "DONE_ON_TIME" , "DONE_OVERDUE" |
greater_than_or_equals | "TODAY" , "TOMORROW" , "YESTERDAY" , "THIS_WEEK" , "ONE_WEEK_AGO" , "ONE_WEEK_FROM_NOW" , "THIS_MONTH" , "ONE_MONTH_AGO" , "ONE_MONTH_FROM_NOW" , "PAST_DATETIME" , "FUTURE_DATETIME" , "UPCOMING" , "OVERDUE" , "DONE_ON_TIME" , "DONE_OVERDUE" |
lower_than | "TODAY" , "TOMORROW" , "YESTERDAY" , "THIS_WEEK" , "ONE_WEEK_AGO" , "ONE_WEEK_FROM_NOW" , "THIS_MONTH" , "ONE_MONTH_AGO" , "ONE_MONTH_FROM_NOW" , "PAST_DATETIME" , "FUTURE_DATETIME" , "UPCOMING" , "OVERDUE" , "DONE_ON_TIME" , "DONE_OVERDUE" |
lower_than_or_equal | "TODAY" , "TOMORROW" , "YESTERDAY" , "THIS_WEEK" , "ONE_WEEK_AGO" , "ONE_WEEK_FROM_NOW" , "THIS_MONTH" , "ONE_MONTH_AGO" , "ONE_MONTH_FROM_NOW" , "PAST_DATETIME" , "FUTURE_DATETIME" , "UPCOMING" , "OVERDUE" , "DONE_ON_TIME" , "DONE_OVERDUE" |
between | Two dates to filter by (e.g. "2023-07-01" ) |
Pro tip
items_page
is only available in API version2023-10
and later.
Examples
The following example returns all items on the specified board with a date column value between April 24th and June 10th, 2023.
query {
boards(ids: 1234567890) {
items_page(
query_params: {rules: [{column_id: "date", compare_value: ["2023-04-24", "2023-06-10"], operator: between}]}
) {
items {
id
name
}
}
}
}
Let's take a look at another one! The following example returns all items on the specified board with a date column value that's greater than June 10th, 2023.
query {
boards(ids: [1234567890]) {
items_page(
query_params: {rules: [{column_id: "date", compare_value: ["EXACT", "2023-06-10"], operator: greater_than}]}
) {
items {
id
name
}
}
}
}
Reading the date column
You can query the date column using the column_values
object. The object has different fields based on which API version you are using. Column values v2 fields will be available in API versions 2023-10
and later, while column values v1 fields are only supported in versions 2023-07
and 2023-04
.
Column values v2
The column_values
object enables you to return column-specific subfields by sending a fragment in your query. Values for the date column are of the DateValue
type.
Pro tip
column_values
v2 fields are only available in API version2023-10
.
query {
items (ids:[1234567890, 9876543210]) {
column_values {
... on DateValue {
time
date
}
}
}
}
Fields
Field | Description |
---|---|
column Column! | The column the value belongs to. |
date String | The column's date value. |
icon String | The selected icon as a string. |
id ID! | The column's unique identifier. |
text String | The column's value as text. |
time String | The column's time value. |
type ColumnType! | The column's type. |
updated_at Date | The column's last updated date. |
value JSON | The column's JSON-formatted raw value. |
Column values v1
You can return the data in a date column in two different formats when you query by column values. The text
field will return the date as a simple string. The value
field will return metadata about the column as a JSON string.
Removing column values v1 support
column_values
v1 fields will no longer be supported in API versions2023-10
and later.
{
"text": "2022-07-19",
"value": "{\"date\":\"2022-07-19\",\"icon\":null,\"changed_at\":\"2022-07-21T12:00:00.000Z\"}"
}
Updating the date column
You can update a date column using the change_simple_column_value
mutation and sending a simple string in the value
argument. You can also use the change_multiple_column_values
mutation and pass a JSON string in the column_values
argument.
Simple strings
To update a date column, send the date as a string in a YYYY-MM-DD format. You can also add a time by passing it in HH:MM:SS format with a space between the date and time. (Make sure to enter the date and time in UTC, so it will be converted to the user's timezone when they look at the board!)
mutation {
change_simple_column_value (item_id:9876543210, board_id:1234567890, column_id:"date", value: "2019-06-03 13:25:00") {
id
}
}
fetch ("https://api.monday.com/v2", {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization' : 'YOUR_API_KEY_HERE'
},
body: JSON.stringify({
query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValue: String!, $columnId: String!) { change_simple_column_value (item_id:$myItemId, board_id:$myBoardId, column_id: $columnId, value: $myColumnValue) { id } }",
variables : JSON.stringify({
myBoardId: 1234567890,
myItemId: 9876543210,
columnId: "date",
myColumnValue: "2019-06-03 13:25:00"
})
})
})
JSON
To update a date column with JSON, send a JSON string with a date and time key (optional). The date should also be in YYYY-MM-DD format, and the time in HH:MM:SS format. (Make sure to enter the date and time in UTC, so it will be converted to the user's timezone when they look at the board!) Check out this mutation in action in our Postman library or follow along with these code samples!
mutation {
change_multiple_column_values(item_id:9876543210, board_id:1234567890, column_values: "{\"date\" : {\"date\" : \"1993-08-27\", \"time\" : \"18:00:00\"}}") {
id
}
}
fetch ("https://api.monday.com/v2", {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization' : 'YOUR_API_KEY_HERE'
},
body: JSON.stringify({
query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }",
variables : JSON.stringify({
myBoardId: YOUR_BOARD_ID,
myItemId: YOUR_ITEM_ID,
myColumnValues: "{\"date\" : {\"date\" : \"1993-08-27\", \"time\": \"18:00:00\"}}"
})
})
})
Clearing the date column
You have two options to clear a date column. First, you can use the change_multiple_column_values
mutation and pass null
, an empty string, or an empty object in the column_values
argument.
mutation {
change_multiple_column_values(item_id:9876543210, board_id:1234567890, column_values: "{\"date\" : null}") {
id
}
}
fetch ("https://api.monday.com/v2", {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization' : 'YOUR_API_KEY_HERE'
},
body: JSON.stringify({
query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }",
variables : JSON.stringify({
myBoardId: 1234567890,
myItemId: 9876543210,
myColumnValues: "{\"date\" : null}"
})
})
})
You can also use the change_simple_column_value
mutation and pass an empty string in the value
argument.
mutation {
change_simple_column_value(item_id:9876543210, board_id:1234567890, column_id: "date", value: "") {
id
}
}
fetch ("https://api.monday.com/v2", {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization' : 'YOUR_API_KEY_HERE'
},
body: JSON.stringify({
query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValue: String!, $columnId: String!) { change_simple_column_value (item_id:$myItemId, board_id:$myBoardId, column_id: $columnId, value: $myColumnValue) { id } }",
variables : JSON.stringify({
myBoardId: 1234567890,
myItemId: 9876543210,
columnId: "date",
myColumnValue: ""
})
})
})
Join our developer community!
We've created a community specifically for our devs where you can search through previous topics to find solutions, ask new questions, hear about new features and updates, and learn tips and tricks from other devs. Come join in on the fun! 😎
Updated about 1 month ago