SOLVED

Re: VTL to display First Monday of Next Month

Go to solution
nwarr
Level 2

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")

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: VTL to display First Monday of Next Month

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: VTL to display First Monday of Next Month

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
Level 10 - Community Moderator

Re: VTL to display First Monday of Next Month