When using Oracle, it is very normal to deal with date, date conversion, date manipulation. Below is a quick guide on how to use them properly.
- trunc key words - trunc keywords is useful to eliminate the time field of the datetime column. You format the time field to a specific format you want also. For example, trunc(date_column); trunc()
Below is the table that shows the format parameters:
Unit | Valid format parameters |
---|---|
Year | SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y |
ISO Year | IYYY, IY, I |
Quarter | Q |
Month | MONTH, MON, MM, RM |
Week | WW |
IW | IW |
W | W |
Day | DDD, DD, J |
Start day of the week | DAY, DY, D |
Hour | HH, HH12, HH24 |
Minute | MI |