Posted by: R Manimaran | July 8, 2008

Crystal Report Convert Days to HH:MM:SS

Create a Formula in Crystal Report

Select the Formula type as Basic

Dim d1,d2

Dim d3 as Number

d1=CDate({tbl.StartDate})

d2=CDate({tbl.EndDate})

d3=DateDiff(“s”,d1,d2)

Dim nOutageMins as Number

Dim nOutageSecs as Number

Dim nOutageHour as Number

Dim nTotalMins as Number

Dim nsec as Number

nsecs=d3

nTotalMins=int(nsec\60);

nOutageSecs=Remainder(nsecs,60)

nOutageMins=Remainder(nTotalmins,60)

nOutageHour=int(nsecs\3600)

formula=cstr(nOutageHour,”00”)+”:”+cstr(nOutageMins,”00”)+”:”+

  cstr(nOutageSecs,”00”);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: