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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Creating a date based on concatenated data

Level 2
Level 2

Hi I am hoping someone can help.  I have an adobe form which I can not change.  The form has individual boxes for each of the 4 values of a year, 2 for month and 2 for day.  These are all individual boxes that a user enters for example if a person puts in todays date they would enter 2 in one box 0 in another, 1 in another and 6 in another for the year and also 2 digits for the month and day.  This part of the design I am not able to change as the form belongs to another organization.

First I am using adobe Livecycle ES-02.  I have used concat to put together a date like YYYY-MM-DD.  However when I go pull the value of the concatenated variable it returns zero.  How do I format my concatenated variable to read as a date.  Ultimately I am trying to put in a condition that says if today's date -the concatenated variable date is less then 5 years then do this.  I can not do that because the concatenated variable is not reading as a date.

Below is the code which I use formcalc.

On ready layout

var date

date=Num2Date(Date(), "MM/DD/YYYY")

var Sepdate


Here is more code so you can see what I am trying to attempt ultimately.  I have added the message box because I wanted to see the value of Sepdate.  As I said it comes up as 0.

On Exit

date=Date2Num(date, "MM/DD/YYYY") - Date2Num(date, "YYYY-MM-DD")


var DateDiff=Num2Date(date,"YYYY-DD-MM")-Num2Date(Sepdate,"YYYY-DD-MM")

Any help would be appreciated

1 Reply
Level 10
Level 10

Hi there,

I can see you're error, within LiveCycle you can't declare a variable in an event and use the variable in another event. Even if it's in the same object.

To do this you should have a global variable or a script object that holds your variable and then you access it from any event!!

Hope this will help ya!