Convert Text from Link Table to Time format?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

So,

I have miltiary time values stored as text in my linked table (Informix).
It looks like this:

14:55:32 (or HH:MM:SS)

I want access to retrieve this TEXT data, but convert it to an actual TIME
format when it arrives onscreen. Can I do this in the Query builder somehow?
 
simsjr said:
I have miltiary time values stored as text in my linked table (Informix).
It looks like this:

14:55:32 (or HH:MM:SS)

I want access to retrieve this TEXT data, but convert it to an actual TIME
format when it arrives onscreen. Can I do this in the Query builder somehow?


In that case, you can use the CDate function to convert the
string to a Date/Time value, which can then be formatted any
way you want. For example, a form text box could use an
expression list this:

=Format(CDate(yourtimefield), "h:nn:ss AMPM")
 
Your query might look something like:

SELECT cdate([YourColumn]) as YourTime FROM YourTable

Ron W
simsjr said:
So,

I have miltiary time values stored as text in my linked table (Informix).
It looks like this:

14:55:32 (or HH:MM:SS)

I want access to retrieve this TEXT data, but convert it to an actual TIME
format when it arrives onscreen. Can I do this in the Query builder
somehow?
 
Very helpful. What if I want to still keep it in military time, but convert
it from text?
 
simsjr said:
Very helpful. What if I want to still keep it in military time, but convert
it from text?


To repeat myself, "once you convert it to a Date/Time value
you can format it any way you want". Military vs. AmPm are
just display formats, they have no effect on the value. If
you leave it as a string value, then it is only a bunch of
characters that you can not do much with (unless it's
unambiguously convertable to a Date/Time value). In
general, you should choose the appropriate data type to
store each value. This allows you to use the standard
built-in functions to operate on the value.

To reiterate, the data type is not affected by the display
format.
 
Back
Top