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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TIME_FORMAT issue 1

Status
Not open for further replies.

logic4fun

Programmer
Apr 24, 2003
85
US
Hi all,
I am trying to retrieve the time from the timestamp
YYYY-mm-dd-hh.mm.ss.nnnnnn
in the format hh:mm:ss

i am trying to use time function and it retrieves me hh.mm.ss and when i use time_format function it gives me an error saying no funtion is found . Do i need to import any environment variables.

Thanks in advance
logic4fun
 
I Am Using Time_Format(timestamp,'24HH:MM:SS') where timestamp is YYYY-mm-dd-hh.mm.ss.nnnnnn and it says no functions by the name time_format with compatible arguments are found

 
NOpe..i Need to Pass..my own TimeStamp of the table. so i am doing Time(<timestamp>) which returns the time as HH.MM.SS but i want as HH:MM:SS

thanks
 
Apparently, the TIME FORMAT for your system is set to ISO (International Standards Organization), which gives the time as HH.MM.SS. In order to convert the time to HH:MM:SS, you need to use the CHAR function and the JIS (Japanese Industrial Standard Christian Era) format as follows:

CHAR(TIME(<timestamp>),JIS)

The TIME function will return the appropriate time string and then the CHAR function will convert it into the desired format.

Hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top