Author |
Message |
rvwinkle
Newbie
Joined: 24 Feb 2010
Location: Canada
Online Status: Offline
Posts: 4
|
Topic: Time format programming Posted: 24 Feb 2010 at 7:31am |
my field prints the time as "1700" but I need it to read as "5:00 pm". Can someone tell me how to format this field?
|
Thanks,
Kim M, Toronto, Canada
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 24 Feb 2010 at 7:36am |
I do not know of a direct way of doing it. I have always created a formula. Basically something like this. You did not tell us the data type for the time, I am assuming it is a number. I am not adding the code to put in the ':'.
if time >= 12 then totext(time) + " pm"
else totext(time) + " am"
I hope this helps.
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
Posted: 24 Feb 2010 at 7:38am |
Is it an actual time field?
If so just right click on it and select Format Field, select the Date and Time tab then select '1:23 pm' as the style.
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 24 Feb 2010 at 7:48am |
Duh! I was thinking it as a number field or a string.
|
IP Logged |
|
rvwinkle
Newbie
Joined: 24 Feb 2010
Location: Canada
Online Status: Offline
Posts: 4
|
Posted: 24 Feb 2010 at 7:50am |
It looks like it's not an actual time field as that option is not there. It is a string. That's why I need the formula instead.
|
Thanks,
Kim M, Toronto, Canada
|
IP Logged |
|
rvwinkle
Newbie
Joined: 24 Feb 2010
Location: Canada
Online Status: Offline
Posts: 4
|
Posted: 24 Feb 2010 at 7:52am |
Kevlray: nope didn't work. must be because it's a string field.
Edited by rvwinkle - 24 Feb 2010 at 7:53am
|
Thanks,
Kim M, Toronto, Canada
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 24 Feb 2010 at 8:00am |
Is there a leading zero in the time field for values < 1000?
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
Posted: 24 Feb 2010 at 8:01am |
is it always a length of 4?
Convert it using a formula
time(left(timefield,2)+':'+right(timefield,2) +':00')
then convert the look as needed as I indicated before.
|
IP Logged |
|
rvwinkle
Newbie
Joined: 24 Feb 2010
Location: Canada
Online Status: Offline
Posts: 4
|
Posted: 24 Feb 2010 at 8:06am |
Thank-you
Thank-you
Thank-you
That worked! I am so glad I found this forum. You guys were great and thanks for responding so quickly.
Cheers!
|
Thanks,
Kim M, Toronto, Canada
|
IP Logged |
|
|