Contenuto principale

DateTime to Formatted String

Convert DateTime signal data type to formatted string

Since R2024b

  • DateTime to Formatted String block icon

Description

The DateTime to Formatted String block converts a DateTime signal data type to a formatted string.

Limitations

The DateTime blocks are available only as an internal feature with early access. Their design is subject to change.

Ports

Input

expand all

DateTime signal, specified as a scalar.

Dependencies

To enable this parameter, set the Input mode parameter to DateTime.

Calendar year, returned as a real numeric scalar whose value is an integer.

Dependencies

To enable this parameter, set the Input mode parameter to Calendar time.

Data Types: single | double

Calendar month, returned as a real numeric scalar whose value is an integer between 1 and 12, inclusive.

Dependencies

To enable this parameter, set the Input mode parameter to Calendar time.

Data Types: single | double

Calendar day of month, returned as a real numeric scalar whose value is an integer between 1 and 31, inclusive.

Dependencies

To enable this parameter, set the Input mode parameter to Calendar time.

Data Types: single | double

Hour, returned as a real numeric scalar whose value is an integer between 0 and 23, inclusive.

Dependencies

To enable this parameter, set the Input mode parameter to Calendar time.

Data Types: single | double

Minutes, returned as a real numeric scalar whose value is an integer between 0 and 59, inclusive.

Dependencies

To enable this parameter, set the Input mode parameter to Calendar time.

Data Types: single | double

Seconds, specified as a real numeric scalar 0 to less than 61.0.

Dependencies

To enable this parameter, set the Input mode parameter to Calendar time.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Output

expand all

Converted DateTime signal, returned as a scalar string.

Data Types: string

Parameters

expand all

Specify the output string format:

  • dd-MMM-uuuu HH:mm:ss

  • yyyy-MM-dd'T'HH:mm:ss

  • yyyy-MM-dd'T'HH:mm:ss t

  • yyyy-MM-dd'T'HH:mm:ss.SSS

  • eee MMM dd HH:mm:ss yyyy\n

  • h:mm:ss a

  • MMMM d, yyyy

  • <enter custom format>

For more information on date formats, see Format. For <enter custom format>, use the supported identifiers to create a custom output string.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: Format
Values: dd-MMM-uuuu HH:mm:ss (default) | yyyy-MM-dd'T'HH:mm:ss | yyyy-MM-dd'T'HH:mm:ss t | yyyy-MM-dd'T'HH:mm:ss.SSS | eee MMM dd HH:mm:ss yyyy\n | h:mm:ss a | MMMM d, yyyy | <enter custom format>

Specify the input mode:

  • DateTimeDateTime data type input from DateTime Clock block.

  • Calendar time — Calendar format of year, month, day, hour, minute, and second.

For more information on date formats, see Format. For <enter custom format>, use the supported identifiers to create a custom output string.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: InputMode
Values: DateTime (default) | Calendar Time

Version History

Introduced in R2024b