On 28-01-18 16:30, Johnny Rosenberg wrote:
2018-01-28 15:45 GMT+01:00 Luuk <luuk34@gmail.com
<mailto:luuk34@gmail.com>>:
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?
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: users+unsubscribe@global.libreoffice.org
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
Context
Re: [libreoffice-users] macro to only change month · Luuk
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.