Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle SQL Date Calculations?
"RK" <rekaben_at_yahoo.com> wrote in message
news:1137177221.693407.71900_at_g43g2000cwa.googlegroups.com...
> Hi, just like to have some quick command reference.
>
> By the following command:
>
> select to_date('20051231','YYYYMMDD') - to_date('20051101','YYYYMMDD')
> from dual;
>
> we can get the difference between the two dates are 60 days.
>
> By using add_months() we can get the month from given difference.
>
> Are there more such quick tools? I would need the following:
>
> Given a date for the day during a given week, output the start and end
> date(s) of that week;
>
> How about given day in a month? Year?
>
> Feburary's last day, or leap year or not?
>
>
> ...
>
>
> Thanks.
>
same place you'll find to_date and add_months documented you'll find Oracles other date functions tht will do all of the above, when used in the correct expressions
look at the format model for the day of the week look at trunc to get the first day of a time period (and, adjusting by 1 day, the last day of the preceeding time period) and for the last_day() of a month ... we'll, you get 3 guesses what that function is called ;-)
++ mcs Received on Fri Jan 13 2006 - 13:07:22 CST
![]() |
![]() |