adspace


how to present a past time in hours, minutes and seconds? : Sql dba

Answer Posted / Amit Kumar Bajpai

To present the time in hours, minutes, and seconds from a timestamp column or variable in SQL, you can use date/time functions like EXTRACT. Here is an example for both MySQL and Oracle:nnMySQL:n```sqlnSELECT CONCAT(HOUR(TIMESTAMP_COLUMN), ' hours ', MINUTE(TIMESTAMP_COLUMN), ' minutes ', SECOND(TIMESTAMP_COLUMN), ' seconds');n```nOracle:n```sqlnSELECT TO_CHAR(TIMESTAMP_COLUMN, 'FFYY HH24:MI:SS') FROM dual;n```

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can delete statement be rollbacked?

1065


Is primary key always clustered index?

1101


What is the current version of sql?

1106


Can we use distinct and group by together?

1148


what is dbms? : Sql dba

1072


what are aggregate and scalar functions? : Sql dba

1143


If a cursor is open, how can we find in a pl/sql block?

1252


how to escape special characters in sql statements? : Sql dba

1125


what is collation? : Sql dba

1242


what is bcp? When does it used? : Sql dba

1065


Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me

2102


Is primary key clustered index?

1028


what are all the common sql function? : Sql dba

1143


How do I remove duplicates in two columns?

1203


how to start mysql server? : Sql dba

1279