VoiceGuide IVR Software Main Page
Jump to content

Datediff Evaluation

Recommended Posts

I have tried everything I can think of to get DateDiff to work. Here is the excerpt from the .vgl log. I am trying to calculate an age (in years) based on caller's input and the current day.

 

{DateDiff("yyyy",01/01/1976, 09/09/2004)}[Eval Age]{0}[Age]{0}

 

I have been to the Microsoft scripting web page that explains how to use this function, but it just doesn't seem to be working because I always get an age of zero...

Share this post


Link to post

Please post your script here and indicate in which module the DateDiff function is called, we can then have a look at it.

Share this post


Link to post

It took some some trial and error, but I did figure it out. You need to encpsulate the date within quotes.

 

DateDiff("yyyy", "01/01/1976", "09/09/2004")

 

But I ended up not even using this method because the result isn't accurate to the day, just the year. It's really only evaluating 2004-1976 = 28. For this application, I needed to be accurate to the day.

 

My real goal is to determine whether the caller is at least 21. So I used:

 

DateAdd("yyyy", 21, "01/01/1976") <= "$RV_MM/$RV_DD/$RV_YEAR"

 

It seems to work much better this way.

 

Thanks for your help!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×