# Thread: Find the date of the previous day of the current date

1. Registered User
Join Date
Jan 2004
Posts
153

## Unanswered: Find the date of the previous day of the current date

Hi,

I would like to find the date of the previous day (last week) of the current date.

like

1. if current date is 09-Oct-2016 (Sunday), want to get the date of previous day 'Thursday'. .. for this answer will be '06 Oct 2016'
2. if current date is 09-Oct-2016 (Sunday), want to get the date of previous day Wednesday'... for this answer will be '05 Oct 2016'

Searched google, but didn't get any suitable answer.

Thanks in advance,
JD

2. Registered User
Join Date
Jun 2004
Posts
812
Provided Answers: 1
Not sure how you're searching - google found "About 478,000 results" for me...

Anyway, this was the first hit that was returned. Is this what you're after?

http://stackoverflow.com/questions/1...on-todays-date

3. Registered User
Join Date
Oct 2007
Posts
161
Provided Answers: 9
how do you get previous day of Sunday being a Thursday?

4. Lost Boy
Join Date
Jan 2004
Location
Croatia, Europe
Posts
4,113
Provided Answers: 5
Something like this?

Code:
```SQL> alter session set nls_date_language = english;

Session altered.

SQL> alter session set nls_date_format = 'dd mon yyyy';

Session altered.

SQL> set verify off
SQL>
SQL> with previous_week as
2  (select (trunc(sysdate) - level + 1) datum,
3          to_char(trunc(sysdate) - level + 1, 'fmDay') dan
4   from dual
5   connect by level <= 7
6  )
7  select * from previous_week
8  where dan = '&par_dan';
Enter value for par_dan: Thursday

DATUM       DAN
----------- ------------------------------------
06 oct 2016 Thursday

SQL> /
Enter value for par_dan: Wednesday

DATUM       DAN
----------- ------------------------------------
05 oct 2016 Wednesday

SQL>```

5. Registered User
Join Date
Jun 2004
Location
Liverpool, NY USA
Posts
2,520
Actually oracle has a function for that.

select next_day(trunc(sysdate-6),'THU') FROM DUAL;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•