Author |
Message |
aarti
Newbie
Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
|
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 Logged |
|
kostya1122
Senior Member
Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
|
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 Logged |
|
aarti
Newbie
Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
|
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 Logged |
|
aarti
Newbie
Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
|
Posted: 24 Apr 2012 at 9:14pm |
thank u so much.. its works
|
IP Logged |
|
aarti
Newbie
Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
|
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 Logged |
|
aarti
Newbie
Joined: 25 Aug 2011
Online Status: Offline
Posts: 17
|
Posted: 25 Apr 2012 at 11:28pm |
also provide conversion for PT2M2.95S as 02:02:95
|
IP Logged |
|
kostya1122
Senior Member
Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
|
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 Logged |
|
|