Hello,
I have a need to have a named reference that is a date.
It seems the only type that a named reference will accept is string (in its Formula property). I have tried passing in different date strings to no avail...
The formula I need to use a DateDiff so the type must be a date.
Is there any support for this?
Thank you in anticipation...
Greg.
Hi Greg,
What you have to do is set the formula on the NamedReference to something like this:
"date( 2009 , 10 , 15 )"
Mike,
Thanks for the answer - that works great for date values.
I should have also mentioned that there is a time component as well (I want to get the hours difference) between two datetime values.
I have tried to also add the hours, minutes, seconds but it tellsme that only 3 parameters are valid for the DATE () function. Is there a way of including the timeofday component as well?
Thanks.
That's odd. This worked just fine for me:
ta_DateTimeClosed = datevalue( "1/5/2009 12:30 PM" )
ta_DateTimeOpened = datevalue( "1/4/2009 1:00 PM" )
datediff( "n" , [ta_DateTimeClosed] , [ta_DateTimeOpened] )
Thanks for the help, It accepts the Datevalue as a formula, however I cannot do "date" functions on it.
The calcvalue returned is an error value with the message
"Incorrect type of argument or operand."
This may be limitation with named references, using date value types...
The formula is:
datediff( "n" , [//ta_DateTimeClosed] , [//ta_DateTimeOpened] )
I have (given up and) changed it to use the date.ticks value (and divide by 10000000!) to simply do the calculations in seconds, then manually divide to get minutes, hours etc.
Thanks for the help.
Okay, then how about this:
"datevalue( "3/5/2009 1:56 PM" )"