Web lists-archives.com

Re: [PHP] Converting a "timestamp"

On 19/02/17 03:34, Jennifer wrote:
> 	Thanks for the function, Don.  That did end up coming in handy, but my main question was about getting the data out of MySQL and then back in, which I couldn’t really solve.  I could get the data into an array and massage it, but I couldn’t figure out how to get it back in.  So I ended up just exporting the data from the table, manipulating the file in PHP, then importing back into the table.  A round about way, but at least it’s done.

Jennifer ...
Your problem here is sorting out just what format IS used in the
database. If the field is a timestamp, it's stored as a number rather
than a string of characters. I think I am right in saying that a Mysql
timestamp is as a 32bit unix style seconds count, while a DATETIME is 64
bit with a layout of numbers something like you describe. The Mysql date
and time functions take care of any conversions, so it is your client
program that is showing the 2017|02|16|04|58|42 which I suspect is
'INTERNAL' format, while you want to use a different 'default' or use
function to give you the correct format.

I don't use Mysql much. Firebird has always had a 64 bit timestamp which
is 32bits day and 32bits time and other databases use their own internal

Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php