VTL to display First Monday of Next Month | Community
Skip to main content
New Participant
September 6, 2023
Solved

VTL to display First Monday of Next Month

  • September 6, 2023
  • 1 reply
  • 1318 views

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.

1 reply

SanfordWhiteman
New Participant
September 6, 2023

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.

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
September 7, 2023