Source language: Translate to:

how do i determine the last day of the month date

General questions about NeoBook

Moderator: Neosoft Support

how do i determine the last day of the month date

Postby yanzco » Sat May 27, 2017 12:17 am

i need a way to determine the date of any month...

for example..

if i have a given date..
invoice date : may 22, 2017
due date : end of month of may 2017

or

if i have a given date..
invoice date : may 22,2017
add 45 days..
and get the end of the month date...

which should be july 31 2017

a bit confusing in leapyear...
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am

Re: how do i determine the last day of the month date

Postby Gaev » Sat May 27, 2017 3:01 am

yanzco:

1) You can add 45 days to a date using ...

- DateToNum
- Math
- NumToDate

2) To get the last date for a month ...

- StrParse a variable containing "31,28,31,30,31,30,31,31,30,31,30,31" (so the resulting Arrayed Variable contains the last day of each month; except for Leap Years)

- StrParse the date (so you get month, day and year components)

- If month is February, check for Leap Year (see http://www.scriptedlogic.com/zzold/neoHOW6.htm ) ... and set the day accordngly
- Else, use the month as the array element number to get the last day of that month
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: how do i determine the last day of the month date

Postby yanzco » Sat May 27, 2017 3:24 am

got it now... thanks!!! :D
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am

Re: how do i determine the last day of the month date

Postby virger » Sat May 27, 2017 8:31 am

Other way, for other programing utilies.
It's a Button
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=PushButton43
X=711
Y=-64
W=158
H=25
Anchor=0
Text=[ElMes[Mes]] Have [nd] Days
Align=2
ImageStyle=0
ObjAction=setvar "[mes]" "4"¶setvar "[yr]" "2017"¶¶¶strparse "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Set,Oct,Nov,Dec" "," "[ElMes]" "[x]"¶¶if "[Mes]" "=" "2"¶    setvar "[nd]" "29"¶    DateToNum "!29/[mes]/[yr]" "d/m/y" "[num]"¶    if "[Num]" "=" "Error"¶        setvar "[nd]" "28"¶        ..alertbox "ALERT" "Feb Have 28 Days"¶    endif¶else¶    DateToNum "!31/[mes]/[yr]" "d/m/y" "[num]"¶    setvar "[nd]" "31"¶    if "[Num]" "=" "Error"¶        setvar "[nd]" "30"¶        ..alertbox "ALERT" "[ElMes[mes]] Have 30 Days"¶    endif¶endif¶..alertbox "OK" "[ElMes[mes]] With [nd] Days"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=62
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 523
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: how do i determine the last day of the month date

Postby yanzco » Sun May 28, 2017 9:41 am

thats a quick and faster one..

mine is long...

Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5.80
ObjectType=3
Name=PushButton1397
X=848
Y=280
W=296
H=104
Anchor=0
Text=[looper]¶get last day of month¶input: "GLDMdatenum"   - must be converted to numeric¶output: "GLDMeom"¶¶end of tghe month is [GLDMeom]
Align=2
ImageStyle=0
ObjAction=NumToDate "[GLDMdatenum]" "m/d/yyyy" "[GLDMconvdate]"¶StrParse "[GLDMconvdate]" "/" "[GLDMparse]" "[GLDMparseNUM]"¶SetVar "[GLDM_targetmonth]" "[GLDMparse1]"¶¶¶SetVar "[GLDMdatechecknum]" "[GLDMdatenum]"¶Loop "1" "31" "[looper]"¶¶Math "[GLDMdatechecknum]+1" "-1" "[GLDMdatecheckNum]"¶NumToDate "[GLDMdatecheckNum]" "m/d/yyyy" "[GLDMdatecheckValue]"¶StrParse "[GLDMdatecheckValue]" "/" "[GLDMparsecheck]" "[GLDMparsecheckNUM]"¶¶If "[GLDM_targetmonth]" "=" "[GLDMparsecheck1]"¶    .same month¶Else¶    . month has changed¶    SetVar "[GLDMtriggerDate]" "![GLDMparsecheck1]/[GLDMparsecheck2]/[GLDMparsecheck3]"¶    DateToNum "[GLDMtriggerDate]" "m/d/y" "[GLDMeomNum]"¶    Math "[GLDMeomNum]-1" "-1" "[GLDMeomNum]"¶    NumToDate "[GLDMeomNum]" "m/d/yyyy" "[GLDMeom]"¶    SetVar "[endGLDM]" "yes"¶    ExitLoop¶Endif¶¶Endloop
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=8
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=19
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 0 guests