Re: Use TRUNC function to get weekday

From: Malcolm Dew-Jones <>
Date: 22 Apr 2009 14:20:00 -0700
Message-ID: <49ef8a00$> wrote:
: Hi,

: Is it possible to use TRUNC function to get the weekday (e.g.
: Monday, Tuesday ...)? I know I can use TO_CHAR to get it:

Perhaps a misunderstanding.

TRUNC(date) returns a new date that is smaller than or equal to the original date.

An Oracle DATE always includes a time portion, so trunc can never return a "day", the closest it ever comes is to returning a date where the time portion corresponds to the start of a day.

Some trunc(date) options involve day periods, such as the default trunc option which truncs the time portion to be the time corresponding to the start of the day (i.e. it sets the hours, minutes, and seconds to 0), and one or more trunc options returns the date that is the start of the day that is the start of the week containing the original date.

If you mean to get the "name" of a day then you need to convert the date to a string. In code you should use always TO_CHAR, though the default date to string conversions are convenient in interactive queries.

TO_CHAR has various output formats for dates, google: [oracle date format models] for more details. For example to_char(sysdate,'DY') returns the abreviation of the name of today.

NEXT_DAY() returns dates corresponding to particular days of the week that come after a specified date.

$0.10 Received on Wed Apr 22 2009 - 16:20:00 CDT

Original text of this message