First and Last date of any Month.

Advertisement
Hi Friends,
I have 2 fields in my table
FROM DATE & TO DATE
User can enter any date in these two fields, but at time of commit i want to change the FROM DATE to the first date of the Month user have entered. And for TO DATE i want to change the last date of the month.
For Example :
User Enters-
FROM DATE 12-Mar-2003
TO DATE 27-Jun-2003
I want to change these date to:
FROM DATE 01-Mar-2003
TO DATE 30-Jun-2003
How can I write a database function or procedure to control this thing.
Please help.
Best regards,
Imran Baig
Advertisement

Replay

It depends on your requirements, but I usually use TRUNC(date, 'D')
to get the first day(Sunday) of the week, because TRUNC(date, 'W')
returns the same day of the week as the first day of the month.
See http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a85397/function.htm#80101
for more info on this.

Converting Period to 1st and last date of that month

Dear all, is there any FM to to do the following:- if in the selection screen i give the date as 09.2007 (MM.YYYY) then i want the output as 01.09.2007 to 30.09.2007 If u go to transaction MC.1  in that u will find this as select options. So when i e

TO FIND START DATE AND END DATE OF THE MONTH

HAI ALL,            I want to find the start of the date for the month and end of the date for the month, for given date. Ex. if input is : 08-06-2007,                                        I want to get the first and last date for this month. . Is

Variable last date of previous month/last date of current month

Hello Experts, I am facing an issue while designing a query. Requirement is like this. Report will be run on monthly basis.so on execution of report, it should prompt for month/year. now on report there are two columns for which I have to get data on

Find the first and last day of week giving a certain date

Hi, i have an application in wich the user puts a date, say today 2010-08-10 and i have to calculate first and last day of that week, in this case 2010-08-09 and 2010-08-15. How can i do this? Many thanks in advance, Nuno Almeidanfalmeida wrote: i ha

Finding first and last members of a group set

Is there any example how to use 'first' and 'last' functions in an sql query ? I have tried to execute a query like this on the scott.emp table : select deptno,min(sal),max(sal),first(sal) from emp group by deptno; but I always get this message: ERRO

How to compare the first and last characters of strings?

lets say we have a name column with values; c1 Antu Anamentu Steven Smith Since A=A and U=U for the first value we need a TRUE and FALSE for the second value SQL. Is this possible to do with REGEXP functions on 10gR2. Thank you.Hi Frank, Just minor c

Jbo:DataScroller - how to ensure 'First' and 'Last' action links appear

I'm working in JDeveloper 10.1.3.5.0. I'd like to know if there's a way to ensure that the action links 'First' and 'Last' will appear, in addition to the 'Next' and 'Previous' ones (that is, assuming we're not already at the first or last range posi

Get Last date of every Month in a year

Hi All, I need to find last date of month for given year. Example: I used to pass date or year such as 2012 or 01-01-2012(DD-MM-YYYY) SQL query needs to return last date of every month such as 31-01-2012 28-02-2012 31-03-2012 30-04-2012 31-12-2012 fo

How do I bulk edit contact's nicknames to first and last names?

i imported contacts to the contacts app and they all say "NoName". i click on one of them and the first and last name fields are empty but the nickname field has the first and last name in it. how can i bulk edit 1120 contacts to change the full

HT202058 iphone 6+ somehow has switched my name on emails into my nephew's name. We share a first and last name but not a middle name. For example, my name might be John George Doe and his name John James Doe. How did this happen? How do I correct it.

iphone 6+ somehow has switched my name on emails into my nephew's name. We share a first and last name but not a middle name. For example, my name might be John George Doe and his name John James Doe. How did this happen? How do I correct it.So if th

Is it possible to select multiple layers by selecting first and last layers?

I frequently get Illustrator files in that have individual objects such as paths on individual layers that could be grouped to make the layers more concise. I find that I have to shift click each individual layer to select it to eventually group it.

How do we find first date of a month and last date of month?

is it required long caluculation or is there any simple method?hi, try this FM -> 'HR_JP_MONTH_BEGIN_END_DATE' chk this also CALL FUNCTION 'LAST_DAY_OF_MONTHS' EXPORTING DAY_IN = sy-datum IMPORTING LAST_DAY_OF_MONTH = v_lastdate. <--Gives you the la

Lack of First and Last Name Reversal in Address Book

I just got a new iMac and transferred the contents of my old eMac running on OS 10.3---(latest) using the Mac transfer system. Problem: in the address book most of the cards do not respond to the Preference setting for First or Last name first. Some

Syncing with Outlook is reversing first and last name

In Outlook 2007 when I add a new contact and type in the full name (say John Doe) it puts in the full name field "John Doe" and files it as Doe, John. This is how I have always done it and all of my contacts are setup like that. When I add a con

How to split 'Full Name' into two columns for 'First' and 'Last' name??

Any ideas on how to achieve this? http://office.microsoft.com/en-us/excel-help/split-names-by-using-convert-text-t o-columns-HA001149851.aspxIf: A1 = Fistname Lastname For firstname: (First Name) B1 =SUBSTITUTE($A1," " & $C1, "") F

How to remove the characters from first and last position of a string?

Hi all, I am creating an application where i am using vb script to export the data to excel. In the excel sheet most of the values are entered with double " quotes. so the entry looks like ""http://www.sap.com"". Notice that it is

Getting to first and last email quickly

Sometimes i pick up my blackberry and find that my mailbox is showing emails or texts that i got 6 months ago.  i then spend 15 minutes scrolling with my trackball to get to the current day's messages. Since there must be some button which automatica

TSQL Query to display First and Last Values of a GROUP as Columns - SQL Server 2008

Could someone please help with the TSQL to achieve the following: Every Employee has 2 records (From & To). Output has to display one record for each employee with From & To as columns. Input Empid Type Date 100 From 5/4/2004 100 To 6/2/2008 101 F

Cisco SPA-504G: Retrieving Broadsoft Personal directory does not display first and last name

Hi, We are using the Cisco SPA-504G on BroadWorks Release 17.sp3. We are using the feature to lookup the different BroadWorks directories through the 'dir' button on the Cisco phone. For configuration you have three choices for telling the phone whic