Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Need a formula to display Time field Post Reply Post New Topic
Author Message
avishalpatil
Newbie
Newbie


Joined: 24 Dec 2010
Online Status: Offline
Posts: 13
Quote avishalpatil Replybullet Topic: Need a formula to display Time field
     Posted: 16 Sep 2011 at 2:08am
Hi ,

I am new in developing the crystal report.
I am having the time field like 00:30:30 from the database having VARCHAR2 data type. I want to convert this field in 00h 30m 30s.

Could you please suggest me the crystal formula to do the same.

Regards
 Vishal
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 16 Sep 2011 at 1:58pm

VARCHAR2 is a string and you can just manipulate the string using the left, mid, and right functions.  It will look something like this:

left({table.field}, 2) + 'h '+ mid({table.field}, 3, 2) + 'm ' + right({table.field}, 2) + 's'
 
-Dell
IP IP Logged
avishalpatil
Newbie
Newbie


Joined: 24 Dec 2010
Online Status: Offline
Posts: 13
Quote avishalpatil Replybullet Posted: 16 Sep 2011 at 6:49pm
Thanks for your post.Its working.
Slight change in the requirement.
If i am having time like 00:03:03 then it should display 3m 3s ,
if time like 01:30:00 then it should display 1h 30m.

Regards
 Vishal
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum