Kaleb,
In that case just try the following command file.
Enter any given date, or double-click for the calender to pick the date.
You'll always get the first and the last date of
the month based on any given date.
In the example shown, the results are as follows:
vGivenDate = 04/19/2017
vStartDate = 04/01/2017
vEndDate = 04/30/2017
-- Start here ...
CLEAR VAR vGivenDate,vEndKey,vStartDate,vEndDate
SET VAR vGivenDate DATE = NULL
LABEL GetDate
CLS
DIALOG 'Enter Date or Double-Click for Calendar' +
vGivenDate=32 vEndKey 1 +
CAPTION 'Get Date' ICON WINDOWS +
OPTION POPUP_ENABLED TRUE +
|POPUP_DIALOG_TYPE DATE
IF vEndkey = '[Esc]' THEN
GOTO Done
ENDIF
IF vGivenDate IS NULL THEN
CLS
PAUSE 2 USING 'You MUST Enter Date!' +
CAPTION 'Enter Date' ICON WARNING +
BUTTON 'Press any key to enter date' +
OPTION BACK_COLOR WHITE +
|MESSAGE_FONT_NAME Tahoma +
|MESSAGE_FONT_COLOR RED +
|MESSAGE_FONT_SIZE 12
GOTO GetDate
ENDIF
SET VAR vStartDate = (RDATE((IMON(.vGivenDate)),1,(IYR4(.vGivenDate))))
SET VAR vEndDate = ((ADDMON(.vStartDate,1))-1)
LABEL Done
CLEAR VAR vEndKey
RETURN
-- End here
Have fun!
Very Best R:egards,
Razzak
At 09:25 AM 2/1/2017, Kaleb Wade wrote:
Thank you Razzak. This works for the current
month, however, the user isn't always looking at
the current month. They can enter any date.
On Wed, Feb 1, 2017 at 8:22 AM, A. Razzak Memon
<<mailto:[email protected]>[email protected]> wrote:
Kaleb,
Here's how ...
To get the first and last day of the current month:
-- Get the first and last date of current month
  CLEAR VARIABLES vStartDate,vEndDate
  SET VAR vStartDate DATE = NULL
  SET VAR vEndDate DATE = NULL
  SET VAR vStartDate = (RDATE((IMON(.#DATE)),1,(IYR4(.#DATE))))
  SET VAR vEndDate = ((ADDMON(.vStartDate,1))-1)
  RETURN
You can also design a cool form to get the first
and last date of current month without user input.
(See attached).
Very Best R:egards,
Razzak
At 09:06 AM 2/1/2017, Kaleb Wade wrote:
I am trying to set two variables using one date
given by user. Whatever date is given by user,
I want to find the first date of the month and
the last date of the month. Below is a simplified
version of what I am trying to do.
FILLIN vdate1 USING 'ENTER THE DATE :'
SET VAR vdate3 = (RDATE((IMON(.vdate1)),01,(IYR(.vdate1))))
SET VAR vdate4 = (RDATE((IMON(.vdate1)),31,(IYR(.vdate1))))
The first date of the month is working fine. I
cannot figure out how to get the last date of the
month, since there are a different number of days in each month.
Does anyone have a suggestion?
--
You received this message because you are subscribed to the Google Groups
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.