Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions

Transformation Language Reference

Transformation Language Reference

Date Format Strings

Date Format Strings

You can evaluate input dates using a combination of format strings and date functions. Date format strings are not internationalized and must be entered in predefined formats as listed in the following table.
The following table summarizes the format strings to specify a part of a date:
Format String
Description
D, DD, DDD, DAY, DY, J
Days (01-31). Use any of these format strings to specify the entire day portion of a date. For example, if you pass 12-APR-1997 to a date function, use any of these format strings specify 12.
HH, HH12, HH24
Hour of day (0-23), where 0 is 12 AM (midnight). Use any of these formats to specify the entire hour portion of a date. For example, if you pass the date 12-APR-1997 2:01:32 PM, use HH, HH12, or HH24 to specify the hour portion of the date.
MI
Minutes (0-59).
MM, MON, MONTH
Month (01-12). Use any of these format strings to specify the entire month portion of a date. For example, if you pass 12-APR-1997 to a date function, use MM, MON, or MONTH to specify APR.
MS
Milliseconds (0-999).
NS
Nanoseconds (0-999999999).
SS, SSSS
Seconds (0-59).
US
Microseconds (0-999999).
Y, YY, YYY, YYYY, RR
Year portion of date (0001 to 9999). Use any of these format strings to specify the entire year portion of a date. For example, if you pass 12-APR-1997 to a date function, use Y, YY, YYY, or YYYY to specify 1997.
The format string is not case sensitive. It must always be enclosed within single quotation marks.
The following table describes date functions that use date format strings to evaluate input dates:
Function
Description
ADD_TO_DATE
The part of the date you want to change.
DATE_DIFF
The part of the date to use to calculate the difference between two dates.
GET_DATE_PART
The part of the date you want to return. This function returns an integer value based on the default date format.
IS_DATE
The date you want to check.
ROUND
The part of the date you want to round.
SET_DATE_PART
The part of the date you want to change.
SYSTIMESTAMP
The timestamp precision.
TO_CHAR (Dates)
The character string.
TO_DATE
The character string.
TRUNC (Dates)
The part of the date you want to truncate.

0 COMMENTS

We’d like to hear from you!