Forum Moderators: coopster
In the MySQL database is a column called time. Values look like this...
20060509133444
20060509133450
20060509133455
Format broken down...
2006-05-09-13-34-55
year,month,day,hour,min,sec
I was able to replicate pulling the information from this column per post/row and inserting it as a time stamp.
However the issue is formating!
I initially have the unformated variable as $time1. I'd like to run a miniscript (what we're doing here) to reformat the script just a little and then assign that to $time2 variable (which I can then insert for echo-ing as part of the post).
So I want
$time1 = '20060509133455';
to be spat out as...
$time2 = 'May 09, 2006 13:34:55';
I'm fine with breaking it down in to extra steps (and bumping up the number on the time variable if need be).
- John
*PS/Note - If you can not get his chat script to work on your server check your phpinfo to check if your register_globals are set to off. If they are you'll want to read and implement some very basic changes to one of the script files. While the directions say to mod two files, I had to re-upload an original (manually patching one file works, but I forgot which needed the patch and which didn't).
SELECT UNIX_TIMESTAMP(`datecolumn`) AS datecolumnTS FROM...then feed the result through PHP's date() [php.net] function.
Otherwise, you can parse out the string into PHP's mktime() [php.net] function to get the timestamp. And, again feed it through the date() function for formatting.