Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Display value in HH:MM:SS format Post Reply Post New Topic
Author Message
aarti
Newbie
Newbie


Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
Quote aarti Replybullet Topic: Display value in HH:MM:SS format
    Posted: 24 Apr 2012 at 3:33am
Hi,

I have following type of value in one of my table column,

PT11.45.28S
PT56.9S
PT4.33S
PT23.20S

i want to get the hours,minutes and second using crystal report formula,

i am using crystal report 2008 designer.

for example:

PT11.45.28S as 11:45:28

PT56.9S as 00:56:09

PT4.33S as 00:04:33

PT23.20S as 00:23:20

Please help ASAP.

Thanks in advance



Edited by aarti - 24 Apr 2012 at 3:34am
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 24 Apr 2012 at 11:34am
you could try
 formula 1
if Length(field) = 11 then mid(field,3,8) else
if Length(field) = 7 and instr(field,".") = 5 then "00."+ mid(field,3,4) +"0" else
if Length(field) = 7 and instr(field,".") = 4 then "00.0"+ mid(field,3,4)  else
if Length(field) = 8 and instr(field,".") = 5 then "00."+ mid(field,3,5) 
formula 2
replace (formula 1,".",":")

hope it works


Edited by kostya1122 - 24 Apr 2012 at 12:08pm
IP IP Logged
aarti
Newbie
Newbie


Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
Quote aarti Replybullet Posted: 24 Apr 2012 at 9:11pm
Hi
Thanx for reply.
but could u plz tell me
what is formula 1 and formula 2...
IP IP Logged
aarti
Newbie
Newbie


Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
Quote aarti Replybullet Posted: 24 Apr 2012 at 9:14pm
thank u so much..
its works
IP IP Logged
aarti
Newbie
Newbie


Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
Quote aarti Replybullet Posted: 25 Apr 2012 at 11:25pm
Hi
Could you please tell me how to convert
PT4.9S as 00:04:09
PT1.4.6S as 01:04:06


Please reply ASAP.

Thanks in advance.
IP IP Logged
aarti
Newbie
Newbie


Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
Quote aarti Replybullet Posted: 25 Apr 2012 at 11:28pm
also provide conversion for PT2M2.95S as 02:02:95
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 26 Apr 2012 at 6:44am
 formula 1
if Length(field) = 11 then mid(field,3,8) else
if Length(field) = 7 and instr(field,".") = 5 then "00."+ mid(field,3,4) +"0" else
if Length(field) = 7 and instr(field,".") = 4 then "00.0"+ mid(field,3,4)  else
if Length(field) = 8 and instr(field,".") = 5 then "00."+ mid(field,3,5) else
if Length(field) = 6 and instr(field,".") = 4 then "00.0"+ mid(field,3,2) +"0"+mid(field,5,1) else
if Length(field) = 8 and instr(field,".") = 4 then "0"+ mid(field,3,2) +"0"+mid(field,5,2)+"0"+mid(field,7,1) else
if Length(field) = 9 and field like "*M*" then "0"+ mid(field,3,1) +".0"+
med(field,5,3)
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.