Bikeman17 Posted April 12, 2013 Posted April 12, 2013 I tried to get the next month name with a calculation field but I only got the current month name with this: MonthName (Get ( CurrentDate )) I thought adding "+ 1" at the end would move the result to the next month Thanks for your tips
doughemi Posted April 12, 2013 Posted April 12, 2013 Let( today = Get(CurrentDate); MonthName(Date(Month(today) +1; Day(today); Year(today))) )
Lee Smith Posted April 12, 2013 Posted April 12, 2013 Your calculation needs to be amended. Try something like Date ( Month ( YourDateLay::date ) +1 ; Day ( YourDateLay::date ) ; Year ( YourDateLay::date ) ) result equals Date Use the Inspector to display only the month Doug you are too fast for me today.
jbante Posted April 12, 2013 Posted April 12, 2013 Doug and Lee's results are in the right direction, but they'll get the wrong result during the last days of longer months: the calculation will return "March" on 31 January, for example. Try using 1 for the day of the month instead of Day ( Get ( CurrentDate ) ) instead: Let ( [ ~date = Get ( CurrentDate ) ] ; MonthName ( Date ( Month ( ~date ) + 1 ; 1 ; Year ( ~date ) ) ) ) 1
Raybaudi Posted April 13, 2013 Posted April 13, 2013 What do you think about: MonthName ( Get ( CurrentDate ) - Day ( Get ( CurrentDate ) ) + 32 ) ?
jbante Posted April 13, 2013 Posted April 13, 2013 MonthName ( Get ( CurrentDate ) - Day ( Get ( CurrentDate ) ) + 32 ) Clever, possibly too clever for its own good. While correct and possibly more performant, it's less obvious what the intention of the calculation is if the next maintenance developer doesn't already know, but this is simple enough for that to be OK with a good explanatory comment (which I'd feel the need to add even to my own in a production solution): /* name of next month */
Recommended Posts
This topic is 4299 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now