2018-01-28 17:01 GMT+01:00 Luuk <[email protected]>:

>
> On 28-01-18 16:30, Johnny Rosenberg wrote:
> > 2018-01-28 15:45 GMT+01:00 Luuk <[email protected]
> > <mailto:[email protected]>>:
> >
> >     You can write a FUNCTION to get next month
> >
> >     Function FirstOfNextMonth(dDate as Date) as Date
> >         if Month(dDate)>=12 then
> >             FirstOfNextMonth = DateSerial(Year(dDate)+1, 1, 1)
> >         else
> >             FirstOfNextMonth = DateSerial(Year(dDate), Month(dDate)+1, 1)
> >         end if
> >     End Function
> >
> >
> >     When you use = FirstOfNextMonth(Now()) is will return 01-02-2018  (if
> >     your date-format = DD-MM-YYYY)
> >
> >
> > Just note that your function always returns the first day of the
> > calculated month. I'm not sure the OP wants that, but maybe I'm wrong.
> >
> >
> It's named 'FirstOfNextMonth()'with a reason! ;)
> Also note that this 'example' function can be adapted to return another
> date (whatever the OP wants).
>
> To return 'NextMonth()' next question should be solved:
> What is next month, if current date is 31 januari?
>

Yes, I asked that, kind of, but if I got an answer I missed it. My
suggestion was EDATE(SomeDate,1) which returns the same day of the
nextmonth, following your ”a” suggestion below.
I didn't say your suggestion was wrong, I was just wondering if it was what
the OP asked for. Maybe it was, maybe it wasn't. Maybe he will write back
and tell us. :)


Kind regards

Johnny Rosenberg



> a) 28 februari, of 29 februari, depending on the year being a leap year
> or not
> b) 3 march 2018, (31 days after 31 januari)
> c) something else.....
>
> The same question for 31 march, and other months which have a NextMonth
> with less days than the current month.
>
>
>
> --
> To unsubscribe e-mail to: [email protected]
> Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-
> unsubscribe/
> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
> List archive: https://listarchives.libreoffice.org/global/users/
> All messages sent to this list will be publicly archived and cannot be
> deleted
>

-- 
To unsubscribe e-mail to: [email protected]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to