DBA > Job Interview Questions > DB2's Dates questions and answers

I want to enter date in format mm-dd-yyyy hh:mm:

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

I want to enter date in format mm-dd-yyyy hh:mm:Ss in DB2. How can I do that?

A: Well, first of all, in DB2 the combination of date and time is known as a TIMESTAMP data type, so you will need to use TIMESTAMP as the data type instead of DATE (which is just the date with no time component). Other DBMSs use the DATE data type to store both date and time data, but not DB2.

     YYYY is year
     MM is month
     DD is day
     HH is hour
     MM is minutes
     SS is seconds and
     mmmmmm is microseconds

That is the only acceptable format of DB2 timestamp data.

(Continued on next question...)

Other Job Interview Questions