Contenu principal

From DateTime

R2026b

Extract value of DateTime input signal

Since R2026b

  • From DateTime block icon

Libraries:
Simulink / DateTime

Description

The From DateTime block extracts the value of a DateTime input signal.

Examples

expand all

This example shows how the From DateTime block converts a DateTime signal to a numerical signal. The block's input is a signal containing the DateTime value 01-Jan-2000 00:00:00. The block's output is the value 946684800, which is the number of seconds between 01-Jan-2000 00:00:00 and the Unix epoch (01-Jan-1970 00:00:00).

model='ex_from_datetime_block';
load_system(model)
sim(model);
open_system(model)

Ports

Input

expand all

DateTime signal, specified as a scalar.

Output

expand all

Value of DateTime signal, returned as a scalar.

The data type for the output port is the same as the data type specified by the input signal StorageDataType property. The data type can be any of these:

  • 'double' — 64-bit double-precision floating point.

  • 'int32' — 32-bit signed integer.

  • 'uint32' — 32-bit unsigned integer.

  • 'fixdt(0,64,32)' — 64-bit unsigned fixed point with 32 fractional bits.

  • 'fixdt(1,64,32)' — 64-bit signed fixed point with 32 fractional bits.

  • 'fixdt(0,128,64)' — 128-bit unsigned fixed point with 64 fractional bits.

  • 'fixdt(1,128,64)' — 128-bit signed fixed point with 64 fractional bits.

Data Types: double | int32 | uint32 | fixed point

Block Characteristics

Data Types

Boolean | bus | datetime | double | fixed point | integer

Direct Feedthrough

yes

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Programmatic Use: Add Block

To add the block programmatically, use the add_block function with one of these library block paths as the source.

"simulink/DateTime/From DateTime"

Example: add_block("simulink/DateTime/From DateTime","myModel/myBlock",MakeNameUnique="on")

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2026b