Set - 2

Question 1 :

How do you get the month from a timestamp?

Answer :

SELECT MONTH(techpreparation_timestamp) from techpreparation_questions;

Question 2 :

How do you offload the time/date handling to MySQL?

Answer :

SELECT DATE_FORMAT(techpreparation_timestamp, '%Y-%m-%d') from techpreparation_questions; A similar TIME_FORMAT function deals with time.

Question 3 :

How do you add three minutes to a date?

Answer :

ADDDATE(techpreparation_publication_date, INTERVAL 3 MINUTE)

Question 4 :

What's the difference between Unix timestamps and MySQL timestamps?

Answer :

Internally Unix timestamps are stored as 32-bit integers, while MySQL timestamps are stored in a similar manner, but represented in readable YYYY-MM-DD HH:MM:SS format.

Question 5 :

How do you convert between Unix timestamps and MySQL timestamps?

Answer :

UNIX_TIMESTAMP converts from MySQL timestamp to Unix timestamp, FROM_UNIXTIME converts from Unix timestamp to MySQL timestamp.