1-- NOTE: this is only applicable for Oracle and/or PL/SQL
2
3-- Example (let's say you get the error for your date of '2020-09-25 14:18:15')
4TO_DATE('2020-09-25 14:18:15', 'YYYY-MM-DD HH24:MI:SS') -- instead of '2020-09-25 14:18:15' only
5
6-- Syntax
7TO_DATE('<your-date-time>', '<your-date-time-format>')
8
9/*
10 Formatting placeholders
11+----------------------------------------------------------------------------------------------------
12| PARAMETER EXPLANATION
13+----------------------------------------------------------------------------------------------------
14| YEAR -----------------> Year, spelled out
15| YYYY -----------------> 4-digit year
16| YYY -----------------> Last 3, 2, or 1 digit(s) of year.
17| YY -----------------> YY
18| Y -----------------> Y
19| IYY -----------------> Last 3, 2, or 1 digit(s) of ISO year.
20| IY -----------------> IY
21| I -----------------> I
22| IYYY -----------------> 4-digit year based on the ISO standard
23| RRRR -----------------> Accepts a 2-digit year and returns a 4-digit year.
24| A value between 0-49 will return a 20xx year.
25| A value between 50-99 will return a 19xx year.
26| Q -----------------> Quarter of year (1, 2, 3, 4; JAN-MAR = 1).
27| MM -----------------> Month (01-12; JAN = 01).
28| MON -----------------> Abbreviated name of month.
29| MONTH -----------------> Name of month, padded with blanks to length of 9 characters.
30| RM -----------------> Roman numeral month (I-XII; JAN = I).
31| WW -----------------> Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
32| W -----------------> Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.
33| IW -----------------> Week of year (1-52 or 1-53) based on the ISO standard.
34| D -----------------> Day of week (1-7).
35| DAY -----------------> Name of day.
36| DD -----------------> Day of month (1-31).
37| DDD -----------------> Day of year (1-366).
38| DY -----------------> Abbreviated name of day.
39| J -----------------> Julian day; the number of days since January 1, 4712 BC.
40| HH -----------------> Hour of day (1-12).
41| HH12 -----------------> Hour of day (1-12).
42| HH24 -----------------> Hour of day (0-23).
43| MI -----------------> Minute (0-59).
44| SS -----------------> Second (0-59).
45| SSSSS -----------------> Seconds past midnight (0-86399).
46| AM, A.M., PM, or P.M. -----> Meridian indicator
47| AD or A.D -----------------> AD indicator
48| BC or B.C.-----------------> BC indicator
49| TZD -----------------> Daylight savings information. For example, 'PST'
50| TZH -----------------> Time zone hour.
51| TZM -----------------> Time zone minute.
52| TZR -----------------> Time zone region.
53+----------------------------------------------------------------------------------------------------
54*/
55