Hi,
I have a time field which can either be hhmmss or hmmss. The hour field can be 1-2 digits without a '0' being prefixed. How can I convert such string to time. I used %(h,s)nnss but that didn't work.
Handling time with variable length
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 38
- Joined: Tue Jun 19, 2012 11:03 pm
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I assume that you actually have a string field, since time fields don't have a format (they are stored as binary numbers).
Simply prefix the string with a "0" character and use the rightmost six characters of the result, with "%hh%nn%ss" as the format string.
Simply prefix the string with a "0" character and use the rightmost six characters of the result, with "%hh%nn%ss" as the format string.
Code: Select all
Right("0" : InLink.TimeString, 6)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 38
- Joined: Tue Jun 19, 2012 11:03 pm
- Location: India