Skip to main content
Level 2
Sep 6, 2023 8:57 PM UTC
Solved

VTL to display First Monday of Next Month

Looking to display a specific date, which is the First Monday of the Next Month. I have tried a number of different ways but I am not making much progress. Has anyone done something similar that might be able to help out?

 

#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("CST6CDT") ) #set( $defaultLocale = $date.getLocale() ) #set( $calNow = $date.getCalendar() ) #set( $ret = $calNow.setTimeZone($defaultTimeZone) ) #set( $calConst = $field.in($calNow) ) #set( $ISO8601DateOnly = "yyyy-MM-dd" ) #set( $ISO8601DateTime = "yyyy-MM-dd'T'HH:mm:ss" ) #set( $ISO8601DateTimeWithSpace = "yyyy-MM-dd HH:mm:ss" ) #set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) #set( $ISO8601DateTimeWithMillisTZ = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" ) #set($nextMonth = $calNow.get($DATE).add($calConst.MONTH, 1)) #while(#nextMonth.get($calConst.DAY_OF_WEEK) != 1) #set($nextMonth = $nextMonth.add($calConst.DAY_OF_MONTH, 1)) #end First monday of next month: $nextMonth.format("MM/dd/yyyy")

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Sep 7, 2023 3:59 AM UTC

2 replies

SanfordWhiteman
User Group Leader
User Group Leader
Sep 6, 2023 9:26 PM UTC

Well, what you’ve posted here isn’t even valid VTL. There’s no #while directive. So certainly not the right approach!

 

I’ll add an official post on this to the blog tonight.

Translate
SanfordWhiteman
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Sep 7, 2023 3:59 AM UTC