Jump to content

Remove colons ":" from a string with PCM?


---
 Share

Recommended Posts

I'm using "getRecordHead("time"), this reports time as follows: 2:25:49 PM (2 hours, 45 minutes, 49 seconds PM).
I want to remove the colons and leave a string as follows: "22549 PM" (2 hours, 45 minutes, 49 seconds PM).

Is this possible with PCM?
Link to comment
Share on other sites

Just whipped this up
unmodified_seconds = ""
seconds = ""
minutes = ""
hours = ""
unmodified_seconds =timeInSeconds()
seconds = mod(unmodified_seconds,60)
minutes = mod(((unmodified_seconds-seconds)/60),60)
hours=(unmodified_seconds-(minutes*60+seconds))/3600
display(hours,minutes,seconds)
Ill leave adding if/then conditions for single digit values and military time etc to you. Heres the meat...
Link to comment
Share on other sites

I did it that way (ok, date is involved):

Datum = dateInNumbers()
Zeit = time()
Tag = strElement(1,".",Datum)
if len(Tag) == 1 then
Tag = text("0",Tag)
endif
Monat = strElement(2,".", Datum)
if len(Monat) == 1 then
Monat = text("0",Monat)
endif
Jahr = strElement(3,".", Datum)
Stunde = strElement(1,":",Zeit)
Minute = strElement(2,":",Zeit)
Sekunde = strElement(3,":",Zeit)
ZeitF = Stunde+"_"+Minute+"_"+Sekunde
DatumFile = Jahr+Monat+Tag+"__"+ZeitF
Link to comment
Share on other sites

Ok, I cut it for you:

Zeit = time()
Stunde = strElement(1,":",Zeit)
Minute = strElement(2,":",Zeit)
Sekunde = strElement(3,":",Zeit)
ZeitFile = Stunde+Minute+Sekunde
Link to comment
Share on other sites

 Share

×
×
  • Create New...