Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time field to a Char Field and make it Military Time

Status
Not open for further replies.

kernal

Technical User
Feb 27, 2001
415
0
0
US
I have a Time field (i.e. 11:23:15.000000PM) and I need to change it to Military time and to a Char field.

Help is appreciated.

Thanks
 
hi,

Code:
To_Char([Time field],'HH24:MI')

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I'm getting an error " Message=ORA-01722: invalid number." I'm using a query manager tool and I just noticed when I view the statement for that time field that it is using some functions already that I can't change so it looks like the following in the statement:

The functions it is already using that I can't change "TO_CHAR(CAST((time field) AS TIMESTAMP),'HH24.MI.SS.FF')" is giving me the 11:23:15.000000PM output.

Thanks
 
So you have no access to time field?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I can create an expression but I can't change any part of "TO_CHAR(CAST((time field) AS TIMESTAMP),'HH24.MI.SS.FF')".

Thanks
 
I got it working "TO_CHAR(TO_DATE(SUBSTR(time field,1,8),'HH24.MI.SS'),'HH24:MI:SS'). Thanks
 
Kernal,

Out of curiosity, could you please post the field description for TIME?

Thanks,

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
“People may forget what you say, but they will never forget how you made them feel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top