This question might be stupid but i am really curious on what is the recommended way. I am making demo rest api for my iOS app. I am iOS programmer and getting into learning php to write my own quick demo api.
On one of my table i have column of type TIMESTAMP. I am sending unix timestamp value to my api that will insert that value into that column.
I checked database and default timestamp value format is stored like
2015-04-15 16:48:25
and unix timestamp is like
1430233486
My API receives unix timestamp from my iOS app. Now my question is do i have to convert this timestamp that my app sends to the format that mysql saves ? I need to save data in single format. One more info: Sometimes if timestamp is not sent by app, then mysql inserts the current timestamp itself and this current timestamp is in format 2015-04-15 16:48:25 again.
My preference is to save in traditional unix timestamp format. Is there any settings/query that if mysql decides to store current timestamp in column than its always in 1430233486 format ?
Note: My assumption is that TIMESTAMP type in mysql means unix TIMESTAMP. There are DATETIME type too in mysql. I may be wrong with my assumption as i can simply use INT type for storing my unix timestamps but i like the feature of mysql inserting current timestamp as default without business logic code if i don't provide any timestamp from app.