Date
The date column represents a date, and it can also include a time. Our API supports this column, so you can read and update the date column via the API.
Reading the date column
You can return the data in a date column in two different formats. The text field will return the data as a simple string, and the value field will return the data as a JSON string.
{
"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 with a simple string value or a JSON string value.
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 a βtimeβ field in HH:MM:SS format. Ensure you separate the date and hour with a space.
You should enter the date and time in UTC, and it will be converted to the user's timezone when they look at the board.
Here's an example: "2019-06-03 13:25:00"
JSON
To update a date column with JSON, send a JSON string with a "date" key and an optional "time" key as well.
The "date" should be in YYYY-MM-DD format, and the time should be in HH:MM:SS format. Both should be in UTC, as the datetime will be converted to the user's timezone when they look at the board.
mutation {
change_multiple_column_values(item_id:11111, board_id:22222, 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'
},
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: "{\"date5\" : {\"date\" : \"1993-08-27\", \"time\": \"18:00:00\"}}"
})
})
})
You can also find the Postman request to change the date column here.
Clearing the date column
You can clear the date column using a change_multiple_column_values
mutation like the one below.
mutation {
change_multiple_column_values(item_id: 2796683069, board_id: 2796683060, column_values: "{\"date4\" : {}}") {
id
}
}
Have questions?
Join our developer community! You can share your questions and learn from fellow users and monday.com product experts.
Donβt forget to search before opening a new topic!
Updated 2 days ago