mardi 19 juillet 2016

PHP: Convert date/time into integer as such (no unix time conversion)

I have what I think should be very simple.

$myVar = date("Ymdhms",time());   // Ex: 20160619162358

When I insert $myVar into a MySQL database it gets saved in Unix Time format or something else.

myVar   int(15)     UNSIGNED     // field structure
1458733290                       // value stored in database instead of 20160619162358

How can I save $myVar as a plain integer so the database just stores it as 20160619162358? I want to convert or save $myVar as int(15).

Does this even make sense?

Thanks!

Aucun commentaire:

Enregistrer un commentaire