{
"title": "day",
"category": "datetime",
"keywords": [
"day",
"datetime",
"date component",
"day of month"
],
"summary": "Extract day-of-month numbers from datetime values.",
"references": [
"https://www.mathworks.com/help/matlab/ref/datetime.day.html"
],
"gpu_support": {
"elementwise": false,
"reduction": false,
"precisions": [],
"broadcasting": "none",
"notes": "datetime values are host-side objects; `day` extracts the day on the CPU."
},
"fusion": {
"elementwise": false,
"reduction": false,
"max_inputs": 1,
"constants": "inline"
},
"requires_feature": null,
"tested": {
"integration": "runmat-ignition/tests/datetime.rs"
},
"description": "`day` extracts the day-of-month from a datetime scalar or array and returns the result as doubles with the same shape as the input.",
"behaviors": [
"`day(t)` accepts datetime scalars and datetime arrays.",
"The output shape matches the input shape.",
"Day values reflect the calendar day stored in the datetime object.",
"Passing a non-datetime value raises a datetime-specific error."
],
"examples": [
{
"description": "Extract the day from a scalar datetime",
"input": "t = datetime(2024, 4, 9, 13, 30, 0);\nd = day(t)",
"output": "d = 9"
},
{
"description": "Extract days from a datetime array",
"input": "t = datetime([2024 2025], [1 6], [15 20]);\nd = day(t)",
"output": "d =\n 15 20"
}
],
"faqs": [
{
"question": "What day does `day` return?",
"answer": "It returns the calendar day-of-month, such as `9` for April 9."
},
{
"question": "Does `day` preserve the input shape?",
"answer": "Yes. The numeric output has the same size as the input datetime array."
},
{
"question": "Does `day` run on the GPU?",
"answer": "No. datetime values are host-side objects, so `day` executes on the CPU."
}
],
"links": [
{
"label": "datetime",
"url": "./datetime"
},
{
"label": "year",
"url": "./year"
},
{
"label": "month",
"url": "./month"
}
],
"source": {
"label": "`crates/runmat-runtime/src/builtins/datetime/mod.rs`",
"url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/datetime/mod.rs"
},
"gpu_residency": "No. `day` reads datetime objects on the CPU and returns ordinary host-side numeric arrays.",
"gpu_behavior": [
"`day` does not dispatch GPU kernels; it extracts the day component from CPU-side datetime objects."
]
}