If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > How to convert character field to 24 hour time format?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-23-10, 14:53
Jake915442 Jake915442 is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
Question How to convert character field to 24 hour time format?

I have a strange problem. When I perform the following query against my logins table, I receive the results in 24 hour format:

select login_name, login_time from logins

login_name login_time
jimbob 16:11
jimbob 16:13
jimbob 16:22

However, when I include a where statement, the results show the real value in that field:

select login_name, login_time from logins
where login_date = today

login_name login_time
jimbob 04:11 PM
jimbob 04:13 PM
jimbob 04:22 PM

Here is my table schema:

create table "informix".logins
(
login_name char(10),
login_date date,
login_time char(8),
);

How can I run my query with the where statement and have my output appear in 24 hour format like the first query? Any help you could provide would be greatly appreciated!
Reply With Quote
  #2 (permalink)  
Old 02-24-10, 12:09
Jake915442 Jake915442 is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
Well, found the problem with my strange output. Turns out the first query selects all records. The first group of records displayed were entered into my table in 24-hour format. When looking at the records displayed in the second query, the records truly appear in 12-hour format with the AM and PM listed.

However, is there still a way to convert the data displayed in my second query to a 24-hour format while leaving the actual records themselves in 12-hour format? Thanks!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On