SAGA 9.12.0 | Tool Library Documentation

Change Date and Time Format


Description

This tool converts various date and time formats into other date and time formats.

Supported input types:

Supported output types:

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.

SpecifierReplaced byExample
%aAbbreviated weekday name *Wed
%AFull weekday name *Wednesday
%bAbbreviated month name *Jul
%BFull month name *July
%cPreferred date and time representation *Wed 16 Jul 2025 14:32:46 CEST
%CCentury (year / 100)20
%dDay of the month, zero-padded (01-31)16
%DDate using the format MM/DD/YY, equivalent to %m/%d/%y07/16/25
%eDay of the month, space-padded ( 1-31)16
%FISO date YYYY-MM-DD, equivalent to %Y-%m-%d2025-07-16
%gWeek-based year, last two digits (00-99)25
%GFull week-based year2025
%hAbbreviated month name, equivalent to %b *Jul
%HHour in 24-hour format (00-23)14
%IHour in 12-hour format (01-12)02
%jDay of the year (001-366)197
%mMonth as number (01-12)07
%MMinute (00-59)32
%nNewline character (\n)
%pAM/PM indicatorpm
%r12-hour time format *2:32:46 pm
%R24-hour time (HH:MM), same as %H:%M14:32
%SSecond (00-60)46
%tTab character (\t)
%TTime in HH:MM:SS format, same as %H:%M:%S14:32:46
%uWeekday number, Monday=1st day (1-7)3
%UWeek number, Sunday=1st day (00-53)28
%VISO week number (01-53)29
%wWeekday number, Sunday=1st day (0-6)3
%WWeek number, Monday=1st day (00-53)28
%xPreferred date format *16/07/25
%XPreferred time format *14:32:46
%yYear, last two digits (00-99)25
%YFull year (4-digit)2025
%zISO Numeric time zone offset (e.g., +0200)+0200
%ZTime 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


Parameters

 NameTypeIdentifierDescriptionConstraints
InputTabletable, inputTABLE--
OutputOutputtable, output, optionalOUTPUT--
OptionsDateTime Fieldtable fieldFIELD--
Input FormatchoiceFORMAT_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 StringtextSTRING_IN--
Example Format Stringchoice [GUI]EXAMPLE_IN-Available Choices: [0]
Output Field NametextFIELD_NAME_OUT-Default: DateTime
Output FormatchoiceFORMAT_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 StringtextSTRING_OUT--
Example Format Stringchoice [GUI]EXAMPLE_OUT-Available Choices: [0]
Field 1table fieldMULTIPLE_FIELD_0--
Input Format 1choiceMULTIPLE_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 1textMULTIPLE_STRING_0--
Example Format String 1choice [GUI]MULTIPLE_EXAMPLE_0-Available Choices: [0]
Field 2table fieldMULTIPLE_FIELD_1--
Input Format 2choiceMULTIPLE_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 2textMULTIPLE_STRING_1--
Example Format String 2choice [GUI]MULTIPLE_EXAMPLE_1-Available Choices: [0]
Field 3table fieldMULTIPLE_FIELD_2--
Input Format 3choiceMULTIPLE_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 3textMULTIPLE_STRING_2--
Example Format String 3choice [GUI]MULTIPLE_EXAMPLE_2-Available Choices: [0]
Field 4table fieldMULTIPLE_FIELD_3--
Input Format 4choiceMULTIPLE_FORMAT_3-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: 6
Input String 4textMULTIPLE_STRING_3--
Example Format String 4choice [GUI]MULTIPLE_EXAMPLE_3-Available Choices: [0]
Field 5table fieldMULTIPLE_FIELD_4--
Input Format 5choiceMULTIPLE_FORMAT_4-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: 7
Input String 5textMULTIPLE_STRING_4--
Example Format String 5choice [GUI]MULTIPLE_EXAMPLE_4-Available Choices: [0]
Field 6table fieldMULTIPLE_FIELD_5--
Input Format 6choiceMULTIPLE_FORMAT_5-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: 8
Input String 6textMULTIPLE_STRING_5--
Example Format String 6choice [GUI]MULTIPLE_EXAMPLE_5-Available Choices: [0]
Field 7table fieldMULTIPLE_FIELD_6--
Input Format 7choiceMULTIPLE_FORMAT_6-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: 9
Input String 7textMULTIPLE_STRING_6--
Example Format String 7choice [GUI]MULTIPLE_EXAMPLE_6-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 ] [-MULTIPLE_FIELD_3 ] [-MULTIPLE_FORMAT_3 ] [-MULTIPLE_STRING_3 ] [-MULTIPLE_FIELD_4 ] [-MULTIPLE_FORMAT_4 ] [-MULTIPLE_STRING_4 ] [-MULTIPLE_FIELD_5 ] [-MULTIPLE_FORMAT_5 ] [-MULTIPLE_STRING_5 ] [-MULTIPLE_FIELD_6 ] [-MULTIPLE_FORMAT_6 ] [-MULTIPLE_STRING_6 ]
  -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
  -MULTIPLE_FIELD_3:    Field 4
	table field
  -MULTIPLE_FORMAT_3:   Input Format 4
	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: 6
  -MULTIPLE_STRING_3:   Input String 4
	text
  -MULTIPLE_FIELD_4:    Field 5
	table field
  -MULTIPLE_FORMAT_4:   Input Format 5
	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: 7
  -MULTIPLE_STRING_4:   Input String 5
	text
  -MULTIPLE_FIELD_5:    Field 6
	table field
  -MULTIPLE_FORMAT_5:   Input Format 6
	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: 8
  -MULTIPLE_STRING_5:   Input String 6
	text
  -MULTIPLE_FIELD_6:    Field 7
	table field
  -MULTIPLE_FORMAT_6:   Input Format 7
	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: 9
  -MULTIPLE_STRING_6:   Input String 7
	text