Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Select Statement - Time in 24hour format
Fri, Apr 19 2013 2:10 AMPermanent Link

Danie van Eeden

Hi,

I'm sure i just missed it in the manual - but is there a way to select the time field (via sql select) into a 24 hour format? (instead of 12 hour AM/PM)?

Regards
Danie
Mon, Apr 22 2013 11:35 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Danie,

<< I'm sure i just missed it in the manual - but is there a way to select
the time field (via sql select) into a 24 hour format? (instead of 12 hour
AM/PM)? >>

Do you want to do this formatting as part of the query itself ?  If so, then
just use the CAST() function (it always uses a 24-hour representation for
time values cast as strings):

SELECT CAST(MyTimeField AS VARCHAR(20)) FROM MyTable

If you want to do it at the TField level of the TDBISAMQuery, you can use
the DisplayFormat property:

MyDBISAMQuery.Open;
MyDBISAMQuery.FieldByName('MyTimeField').DisplayFormat:='h:nn:ss';

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Apr 23 2013 3:00 AMPermanent Link

Danie van Eeden

Hi Tim,

thank you

This

"SELECT CAST(MyTimeField AS VARCHAR(20)) FROM MyTable"

is what I was looking for. Should have tried it before asking. Thanks again.

Danie
Image