Change Date and Time Format
| Author(s) | J. Spitzmüller (c)) 2025 |
| Library ID | table_tools |
| Tool ID | 29 |
| Version | Beta |
| Menu | Table | Date and Time |
Description
This tool converts various date and time formats into other date and time formats.
Supported input types:
Supported output types:
- Formatted string
- SAGA date field
- Julian Day Number
- Modified Julian Day Number
- Unix timestamp
- Or single components
For formatted strings, the tool uses strftime syntax to read from and write to text. In the GUI, users can select an example format string to quickly apply common formats, which can then be customized as needed.
JDN, MJD, and Unix timestamps are expected in UTC as input and are also returned in UTC. All other operations are performed in local time.
| Specifier | Replaced by | Example |
|---|
%a | Abbreviated weekday name * | Wed |
%A | Full weekday name * | Wednesday |
%b | Abbreviated month name * | Jul |
%B | Full month name * | July |
%c | Preferred date and time representation * | Wed 16 Jul 2025 14:32:46 CEST |
%C | Century (year / 100) | 20 |
%d | Day of the month, zero-padded (01-31) | 16 |
%D | Date using the format MM/DD/YY, equivalent to %m/%d/%y | 07/16/25 |
%e | Day of the month, space-padded ( 1-31) | 16 |
%F | ISO date YYYY-MM-DD, equivalent to %Y-%m-%d | 2025-07-16 |
%g | Week-based year, last two digits (00-99) | 25 |
%G | Full week-based year | 2025 |
%h | Abbreviated month name, equivalent to %b * | Jul |
%H | Hour in 24-hour format (00-23) | 14 |
%I | Hour in 12-hour format (01-12) | 02 |
%j | Day of the year (001-366) | 197 |
%m | Month as number (01-12) | 07 |
%M | Minute (00-59) | 32 |
%n | Newline character (\n) | |
%p | AM/PM indicator | pm |
%r | 12-hour time format * | 2:32:46 pm |
%R | 24-hour time (HH:MM), same as %H:%M | 14:32 |
%S | Second (00-60) | 46 |
%t | Tab character (\t) | |
%T | Time in HH:MM:SS format, same as %H:%M:%S | 14:32:46 |
%u | Weekday number, Monday=1st day (1-7) | 3 |
%U | Week number, Sunday=1st day (00-53) | 28 |
%V | ISO week number (01-53) | 29 |
%w | Weekday number, Sunday=1st day (0-6) | 3 |
%W | Week number, Monday=1st day (00-53) | 28 |
%x | Preferred date format * | 16/07/25 |
%X | Preferred time format * | 14:32:46 |
%y | Year, last two digits (00-99) | 25 |
%Y | Full year (4-digit) | 2025 |
%z | ISO Numeric time zone offset (e.g., +0200) | +0200 |
%Z | Time zone name or abbreviation (empty if zone can not determined) * | CEST |
%% | A literal percent sign (%) | % |
* The specifiers marked with an asterisk (*) are locale-dependent.The output field type ist string for formatted string, date for saga date field, double for JDN and MJD, signed long for unix timestamp and unsigned short for the individual components exept year (signed int).
References
strftime() Man-Page at archlinux.org
Formatting Calendar Time - The GNU C Library
Julian day numbers - Wikipedia
Modified JD (Variants section of JD Article) - Wikipedia
Unix time - Wikipedia
Parameters
| | Name | Type | Identifier | Description | Constraints |
| Input | Table | table, input | TABLE | - | - |
| Output | Output | table, output, optional | OUTPUT | - | - |
| Options | DateTime Field | table field | FIELD | - | - |
| Input Format | choice | FORMAT_IN | - | Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Julian Day Number (JDN)
[3] Modified Julian Day Number (MJD)
[4] Unix Timestamp
[5] Multiple Fields
Default: 0 |
| Input Format String | text | STRING_IN | - | - |
| Example Format String | choice
[GUI] | EXAMPLE_IN | - | Available Choices:
[0] |
| Output Field Name | text | FIELD_NAME_OUT | - | Default: DateTime |
| Output Format | choice | FORMAT_OUT | - | Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Julian Day Number (JDN)
[3] Modified Julian Day Number (MJD)
[4] Unix Timestamp
[5] Day of the Year
[6] Year
[7] Month
[8] Day
[9] Hour
[10] Minute
[11] Second
[12] Millisecond
Default: 0 |
| Output Format String | text | STRING_OUT | - | - |
| Example Format String | choice
[GUI] | EXAMPLE_OUT | - | Available Choices:
[0] |
| Field 1 | table field | MULTIPLE_FIELD_0 | - | - |
| Input Format 1 | choice | MULTIPLE_FORMAT_0 | - | Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Day of the Year
[3] Year
[4] Month
[5] Day
[6] Hour
[7] Minute
[8] Second
[9] Millisecond
Default: 3 |
| Input String 1 | text | MULTIPLE_STRING_0 | - | - |
| Example Format String 1 | choice
[GUI] | MULTIPLE_EXAMPLE_0 | - | Available Choices:
[0] |
| Field 2 | table field | MULTIPLE_FIELD_1 | - | - |
| Input Format 2 | choice | MULTIPLE_FORMAT_1 | - | Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Day of the Year
[3] Year
[4] Month
[5] Day
[6] Hour
[7] Minute
[8] Second
[9] Millisecond
Default: 4 |
| Input String 2 | text | MULTIPLE_STRING_1 | - | - |
| Example Format String 2 | choice
[GUI] | MULTIPLE_EXAMPLE_1 | - | Available Choices:
[0] |
| Field 3 | table field | MULTIPLE_FIELD_2 | - | - |
| Input Format 3 | choice | MULTIPLE_FORMAT_2 | - | Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Day of the Year
[3] Year
[4] Month
[5] Day
[6] Hour
[7] Minute
[8] Second
[9] Millisecond
Default: 5 |
| Input String 3 | text | MULTIPLE_STRING_2 | - | - |
| Example Format String 3 | choice
[GUI] | MULTIPLE_EXAMPLE_2 | - | Available Choices:
[0] |
Command Line
Usage: saga_cmd table_tools 29 [-TABLE ] [-OUTPUT ] [-FIELD ] [-FORMAT_IN ] [-STRING_IN ] [-FIELD_NAME_OUT ] [-FORMAT_OUT ] [-STRING_OUT ] [-MULTIPLE_FIELD_0 ] [-MULTIPLE_FORMAT_0 ] [-MULTIPLE_STRING_0 ] [-MULTIPLE_FIELD_1 ] [-MULTIPLE_FORMAT_1 ] [-MULTIPLE_STRING_1 ] [-MULTIPLE_FIELD_2 ] [-MULTIPLE_FORMAT_2 ] [-MULTIPLE_STRING_2 ]
-TABLE: Table
table, input
-OUTPUT: Output
table, output, optional
-FIELD: DateTime Field
table field
-FORMAT_IN:
Input Format
choice
Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Julian Day Number (JDN)
[3] Modified Julian Day Number (MJD)
[4] Unix Timestamp
[5] Multiple Fields
Default: 0
-STRING_IN: Input Format String
text
-FIELD_NAME_OUT: Output Field Name
text
Default: DateTime
-FORMAT_OUT:
Output Format
choice
Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Julian Day Number (JDN)
[3] Modified Julian Day Number (MJD)
[4] Unix Timestamp
[5] Day of the Year
[6] Year
[7] Month
[8] Day
[9] Hour
[10] Minute
[11] Second
[12] Millisecond
Default: 0
-STRING_OUT: Output Format String
text
-MULTIPLE_FIELD_0: Field 1
table field
-MULTIPLE_FORMAT_0:
Input Format 1
choice
Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Day of the Year
[3] Year
[4] Month
[5] Day
[6] Hour
[7] Minute
[8] Second
[9] Millisecond
Default: 3
-MULTIPLE_STRING_0: Input String 1
text
-MULTIPLE_FIELD_1: Field 2
table field
-MULTIPLE_FORMAT_1:
Input Format 2
choice
Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Day of the Year
[3] Year
[4] Month
[5] Day
[6] Hour
[7] Minute
[8] Second
[9] Millisecond
Default: 4
-MULTIPLE_STRING_1: Input String 2
text
-MULTIPLE_FIELD_2: Field 3
table field
-MULTIPLE_FORMAT_2:
Input Format 3
choice
Available Choices:
[0] Formatted String
[1] SAGA Date Field Type
[2] Day of the Year
[3] Year
[4] Month
[5] Day
[6] Hour
[7] Minute
[8] Second
[9] Millisecond
Default: 5
-MULTIPLE_STRING_2: Input String 3
text