Concatenate Times

  • Thread starter Thread starter Dawn
  • Start date Start date
D

Dawn

Thanks Kip for reply. Still does not work. I still
get the leading 0.
-----Original Message-----
=IIf([EndTime]>[StartTime],(Format([StartTime],"Medium
Time")) & " to " & (Format([EndTime],"Medium Time")),
(Format([StartTime],"Medium Time")))

How can I get this to work and also remove the leading 0
from time if hour of time is 1:00 p.m. to 9:00 p.m.(so it
isn't display for instance like 01:00 p.m. to 09:00 p.m.)

Thanks!
.
I pasted your code into a txt field. It didn't work so I
looked at the formula and it had weird characters in the
string "Medium Time": looked more like "me""\d""ium
T\\d" or something weird like that. Changed it
to "Medium time" and it worked as expected.
 
-----Original Message-----
Thanks Kip for reply. Still does not work. I still
get the leading 0.
-----Original Message-----
=IIf([EndTime]>[StartTime],(Format([StartTime],"Medium
Time")) & " to " & (Format([EndTime],"Medium Time")),
(Format([StartTime],"Medium Time")))

How can I get this to work and also remove the leading 0
from time if hour of time is 1:00 p.m. to 9:00 p.m.(so it
isn't display for instance like 01:00 p.m. to 09:00 p.m.)

Thanks!
.
I pasted your code into a txt field. It didn't work so I
looked at the formula and it had weird characters in the
string "Medium Time": looked more like "me""\d""ium
T\\d" or something weird like that. Changed it
to "Medium time" and it worked as expected.
forgot about the formatting problem, I was concentrating
on the problem I got when I pasted your code (which was
probably an artifact from the bulletin board)

if you look in the help file under formatting you will
see how to create a user defined format for dates and
time (rather than medium time): what you want is h:nn:ss
which is h (hours without leading zero):nn(minutes with
leading zeros):ss(seconds with zero). nn is used to
avoid conflict with month. Put this in the format
without quotes

Kip
 
Ignore this part, 'no quotes' only applies to format
property in a control. in your application, you will
need to use quotes in the format$() function: format
([time],"h:nn:ss")

Sorry
 
Back
Top