Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

How to get field to advance to the 1st of the next month

OlyChristine
Level 1
Level 1

I am trying to figure out how to get a date field (effDate1) to advance to the first of the next month from the previous date field (retireDate1). For example, if I enter 03/20/2015 in the field titled retireDate1 - the next date field, titled effDate1, needs to be the 1st of the following month - 04/01/2015. Any help is greatly appreciated!!

FormCalc

Date Pattern: MM/DD/YYYY

3 Replies
jasotastic81
Level 7
Level 7

if (HasValue(retireDate1)) then


  var retireDate1_ = Date2Num(retireDate1.formattedValue, "MM/DD/YYYY")


  retireDate1_ = retireDate1_ + 1


  while (Substr(Num2Date(retireDate1_,"MM/DD/YYYY"),4,2 ne "01") do


    retireDate1_ = retireDate1_ + 1


  endwhile


  $ = Num2Date(retireDate1_, "MM/DD/YYYY")


endif


See if that works for you.

OlyChristine
Level 1
Level 1

syntax error near token 'do'

I should be able to figure this out, Friday brain, but I feel it's close.

jasotastic81
Level 7
Level 7

I noticed that after I copy/pasted from the forum, my quotes started acting weird in LC. May have to check that.