Recently got this question on how to extract the day of the week from date.

Here is one method.

select datecolumn, to_char(datecolumn, 'E') from base_table limit 10;
+------------+------------+
|    date    |   EXPR$1   |
+------------+------------+
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
| 2015-02-01 | Sun        |
+------------+——————+


The table on this page is very useful when dealing with Drill date functions 
and conversions.

http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html



Happy Friday Drilling :-)

—Andries


Reply via email to