Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Adding two Dates to number of days

Avatar

Former Community Member

Hello,

    I'm designing a page which will calculate a start calendar date with a ending calendar date and give me the total number of DAYS between them.

I've tried numerous formcalc and javascript pages but can not find the solution. I bet this is simple and would appreciate the help.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi,

You can use this script Date2Num(to.rawValue, "YYYY-MM-DD") - Date2Num(from.rawValue, "YYYY-MM-DD")

Example attached.

BR

View solution in original post

3 Replies

Avatar

Correct answer by
Level 6

Hi,

You can use this script Date2Num(to.rawValue, "YYYY-MM-DD") - Date2Num(from.rawValue, "YYYY-MM-DD")

Example attached.

BR

Avatar

Former Community Member

You gave me great advise. I was wondering if I could ask for more assistance.

I work for a government department and I'm trying to create a sentence length Date and Fine Calculator.

I have a starting date (pop down calendar) and wish to add total days to serve (which is a number "20, 30, etc."

For the answer I created a (date/time field) I attempted several ways using the advise you gave but was unsuccessful.

I also need to convert the dates to 2 for 1 and 3 for 1. All answered with calender dates.

I also need to add the total days to serve with number of days after converting fines to days.

I know this is confusing and i will attach the pdf file to this email.

I know this is a bother but my IT department has no clue with livecycle.

Just asking and would gratefully appreciate the help.

Sgt. Donald Graham

Midland County Sheriff's Office

Avatar

Level 6

Hi,

Actually i can't understand what do you need )

"Add startdate to total days to serve" - What does it means? You have f.e. 23.01.2009 you want to add 3 days and get 26.01.2009?

"also need to convert time to 2 for 1 and 3 for 1" - ?

Paul Butenko