i ran this cmd and i got this as output 2021-02-09 00:15:37 $time=date("dmyHis", time()); echo $time; also suggest me a better way to store timestamp in the mysql table through php
with that you can get output only in format DDMMYYHHIISS DD - Day (01-31), MM - Month (01-12), YY - Year (00 - 99), two digits. HHIISS, hours-minutes-seconds So you can't get output like "2021-02-09 00:15:37" if you want to insert date/time in MySQL best format for that is 'YYYY-MM-DD HH:mm:ss' or 'YYYYMMDDHHmmss' in PHP you can get this with command $time = date('Y-m-d H:i:s',time()); or $time = date('Y-m-d H:i:s',time()); Also you can use MySQL function "NOW()" in insert statement. If your column is type of timestamp, as I recall you don't need to update values for that column types, since they are updated with every insert/update statement.