cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to caluculate difference in days between two dates

Former Member
0 Likes
437

Hi guys,

Can you please give suggestion how to find out the difference between two dates(difference should be in number of days)

I tryed by the fallowing expression bellow

datediffdatediffdays(Repeater_0.Output{/Row/afd} , Repeater_0.Output{/Row/sfd} )

afd and sfd are two dates.

afd and sfd are Data types of Date

when i Evaluate it was given error in valid date format parameters used as parameters

xMII datasource is MySQL database.

please guide me.

Thanks

Srikanth M

Accepted Solutions (0)

Answers (3)

Answers (3)

salvatore_castro
Product and Topic Expert
Product and Topic Expert
0 Likes

Try formatting the Repeater_0 values to <b>XML Dates</b> first...as of now they are just <b>strings</b>.

jcgood25
Active Contributor
0 Likes

Srikanth,

Evaluate will not work in this case because it really only has the column knowledge at design time (not the actual row of data that it will have iteratively at runtime).

The function name in your post looks like a typo (datediffdays is the right name), and if you want to see it work put the expression in a tracer and hit F6.

With your datasource being a relational database you would have a similar function in sql which is <a href="http://datediff">http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html</a>

Depending upon your needs you may be better off doing the datediff function in your SQL Query template and not in BLS.

Regards,

Jeremy

Former Member
0 Likes

Did you try executing the transaction?

Probably you will not see this error @ run time as the Dates would have some values.