RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • calendarDuration
    • dateshift
    • datetime
    • day
    • duration
    • hour
    • minute
    • month
    • second
    • year

day — Extract calendar-day numbers or weekday names from datetime and legacy date inputs.

day supports dayofmonth, dayofweek, iso-dayofweek, dayofyear, name, and shortname for datetime inputs. Numeric modes return host doubles with matching shape; name modes return same-shaped cell arrays of character vectors. Legacy serial-number and text inputs are retained for compatibility and return day-of-month values.

Syntax

X = day(t)
X = day(t, dayType)

Inputs

NameTypeRequiredDefaultDescription
valueAnyYes—Datetime input.
tAnyYes—Datetime, legacy serial date number, or date text.
dayTypeStringScalarYes—dayofmonth, dayofweek, iso-dayofweek, dayofyear, name, or shortname.

Returns

NameTypeDescription
XAnyNumeric scalar/tensor result.
outAnyMethod result.

Errors

IdentifierWhenMessage
RunMat:datetime:InvalidArgumentArguments or option grammar do not match supported datetime forms.datetime: invalid argument
RunMat:datetime:InvalidInputInput values cannot be parsed/converted/broadcast to a valid datetime result.datetime: invalid input
RunMat:datetime:InternalInternal datetime state or indexing/evaluation failed unexpectedly.datetime: internal operation failed

How day works

  • day(t) defaults to day-of-month. day(t, dayType) accepts dayofmonth, dayofweek with Sunday equal to 1, iso-dayofweek with Monday equal to 1, dayofyear, name, and shortname.
  • Numeric output is double and preserves input shape. Name output is a same-shaped cell array of character vectors; NaT yields NaN numerically and an empty character vector in name modes.
  • Legacy serial date numbers accept single, double, and all eight integer classes. Legacy date text may provide its datestr-style input format as the second argument; in that dialect lowercase mm denotes month, as in day("2021/28/09", "yyyy/dd/mm").
  • Logical and resident numeric legacy inputs are not part of the public compatibility surface. They are rejected in MATLAB-compatible mode before any resident provider access and are available only through declared RunMat extensions.

Does RunMat run day on the GPU?

day does not dispatch GPU kernels; it extracts the day component from CPU-side datetime objects.

GPU memory and residency

No. day reads datetime objects on the CPU and returns ordinary host-side numeric arrays.

Examples

Extract the day from a scalar datetime

t = datetime(2024, 4, 9, 13, 30, 0);
d = day(t)

Expected output:

d = 9

Extract days from a datetime array

t = datetime([2024 2025], [1 6], [15 20]);
d = day(t)

Expected output:

d =
    15    20

Extract ISO weekday numbers

t = datetime(2024, 4, 9);
d = day(t, 'iso-dayofweek')

Expected output:

d = 2

Extract short weekday names

n = day(datetime(2024, 4, 9), 'shortname')

Expected output:

n = {'Tue'}

Using day with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how day changes the result.

Run a small day example, explain the result, then change one input and compare the output.

FAQ

What day does day return?⌄

It returns day-of-month by default. The optional day type selects weekday numbering, ISO weekday numbering, day-of-year, or full and abbreviated weekday names.

Does day preserve the input shape?⌄

Yes. The numeric output has the same size as the input datetime array.

Does day run on the GPU?⌄

No. datetime values are host-side objects, so day executes on the CPU.

Related Datetime functions

calendarDuration · dateshift · datetime · duration · hour · minute · month · second · year

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how day is executed, line by line, in Rust.

  • View the source for day in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How day works
  • Does RunMat run day on the GPU?
  • GPU memory and residency
  • Examples
  • Extract the day from a scalar datetime
  • Extract days from a datetime array
  • Extract ISO weekday numbers
  • Extract short weekday names
  • Using day with coding agents
  • FAQ
  • Related Datetime functions
  • Open-source implementation
  • About RunMat