Converting PHP String having a unix timestamp value to a MySQL Timestamp value -


I am setting a database value with a PHP file. In the php file I have a string variable that stores the Unix timestamp value.

I have a schema in my SQL table, where I must put these timestamp values ​​in the log field, which is the timestamp datatype.

I tried to send

  date ('Y-M-DG: I: S', stratomet ($ user login)); My database contains   

but this store is 0000-00-00 00:00:00

The purpose of strotom () is to convert stars to unix timestamps in different date formats. If the string is already a timestamp, then it does not appear to be a meaningful formatted date / time for stratotem () and it will fail.

If the string is already a timestamp, then you do not need to do more than just round it (strictly saying that this step should also not be necessary, but casting someone Non-numeric characters will also exit the type, so it generally does not hurt the artists)

Additionally, MySQL is able to parse Unix timestamps (with FROM_UNIXTIME () , I think, make sure I see it)

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -