Skip to Content
avatar image
Former Member

Need help with cdatetime formula & datediff formula

I need some help writing formulas:

1) I have

a) Evaluating date 10/21/09

b) Evaluating time 03:18PM

c) Monitoring date 10/21/09

d) Monitoring time 03:21PM

How would I write my formula using cdatetime to combine evaluating date plus evaluating time? (e)

I would also neeed to write a formula to combine monitoring date plus monitoring time as well. (f)

2) I would also need to write a formula to get the number of hours different between (evaluating date + evaluating time) and

(monitoring date + monitoring time) using datediff?

Thanks in advance for your help.

T

2)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jun 24, 2010 at 04:05 PM

    This should do the trick for you...

    EvalDateTime
    DateTime(Date({TableName.EvaluatingDate}),Time({TableName.EvaluatingTime}))
    

    MonitorDateTime
    DateTime(Date({TableName.MonitoringDate}),Time({TableName.MonitoringTime}))
    

    HoursDiff
    DateDiff("h", {@EvalDateTime},{@MonitorDateTime})
    

    HTH,

    Jason

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Well you have a couple of options...

      1) You can calculate a a date using the "CurrentDateTime"

      2) You could calculate a default date using the the "Evaluating date"

      3) Set it to "0"

      1)

      IF IsNull({MonitorDate}) THEN CurrentDateTime ELSE {MonitorDate}
      

      2) this example adds a default 24hrs to the eval datetime if the monitor dt is null

      IF IsNull({MonitorDate}) THEN DateAdd("h", 24, {EvalDate}) ELSE {MonitorDate}
      

      3)

      IF IsNull({MonitorDate}) THEN {EvalDate} ELSE {MonitorDate}
      

      Basically, it just depends on what you want the result to be...

      HTH,

      Jason