About Time Conversion

Wong

Active Member
Dear all,

Do anyone of you did before to convert a numeric type of time to words format?

Example:
Input: 163000
Output: 4.30PM

Note: Input in numeric data type while output should be in string data type.

I try to search from the JDE standard business function but most of them are conversion to date format rather than time format.

Thanks & Regards,
Wong
 
I don't know of anything built in. . .

This is off the cuff, so some tuning may be necessary.


mnDecVariable = mnInput/10000
mnHour = floor(mnDecVariable)
mnMinute= mnInput-(mnHour * 1000)
szMeridian = "AM"
If mnHour > 12
mnHour=mnHour-12
szMeridian = "PM"
End

OutputString = (mnHour) // the tool will convert for you in ER
OutputString = Concat(OutputString,'.')
OutputString = Concat(OutputString,floor(mnMinute/100))
OutputString = Concat(OutputString,szMeridian)


Good Luck!
 
Hi..

For mnMinute calculation, i think it shud be mnHour*10000 instead of mnHour*1000.

Thanks,
Deepak
 
here is an sql code for the time conversion. Replace the time filed with the sytday field

select
case when length(sytday) <6 then Concat(Concat(concat(concat(substr(sytday,1,1),':'),concat(substr(sytday,2,2),':')),substr(sytday,4,2)),'AM')else
Concat(Concat(concat(concat(substr(sytday,1,2)-12,':'),concat(substr(sytday,3,2),':')),substr(sytday,5,2)),'PM')end Updated
from proddta.f47036
 
I use B1700380 functions to convert time to string (or reverse) but format it uses is HH:MM:SS
No AM/PM
 
Back
Top