I have a script that will insert a timestamp into the database with each new submission. However, when I call on the timestamp: I get it as MYSQL sees it: How can I convert this into: I don't care about the time part. Or is there a better way I could be doing this rather than using the timestamp?
Darn it! I was trying to be lazy and you ruined it. Thanks. Just kidding. I'm a visual learner and when it comes to PHP, I learn backwards. I've tried for 5 years to read php.net and other help sites but it never sank in until I get the actual code. Only then could I learn how php works by dissecting the code and basically trial and error. However, I'm not using that as an excuse. I'm going to go to the url you suggested and see what I can come up with. Thanks!
Yay! I found something to replace it. I changed date to varchar instead of timestamp. And then I used: on the form to auto come up with the date for me. And Wahoo! It's works. Thanks.
if you get this timestamp from mysql, it is probably faster and better if you use the mysql date function, so you can just use the string in php: SELECT DATE_FORMAT(mytimestamp, '%M %D, %Y') AS mydate FROM mytable; PHP: see also http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html ands scroll down a few pages.
I would say FalconDriver has the best idea. If you for some reason cannot do that, I would use a combination of php's date and strtotime functions. $NewDate = date("F jS, Y", strtotime($MysqlDate)); PHP: Both of these I think are better options than storing the information from a hidden form variable. I could spoof your form and include anything in that field since you made it a varchar field. Use the built-in MySQL Date Functions...if not possible, use the PHP functions...
I'm not sure, will this work? The MySQL date given is more of a String Date than a Unix Timestamp, thats why I used strtotime.
<? echo $date = date("F js, Y", $row_logs['time']; ?> PHP: Eh? I cant seem to get it work on my end. Thoughts?