I have a variable in my database of type timestamp. Its default value is “CURRENT_TIMESTAMP” which is a great feature.
However when I output the variable in the template it is formatted to an actual date. Is php doing something fancy here or is the date in the database still stored as a timestamp? I need to perform some calculations on the date for some features in the system.
You are confusing MySQL TIMESTAMPs (
YYYY-MM-DD HH:MM:SS) with Unix TIMESTAMPS (seconds since the epoch).SELECT UNIX_TIMESTAMP(timestamp_column_name) FROM ...should give you what you wantMySQL Manual (UNIX_TIMESTAMP)