Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MySQL varchar and dates

Date format using varchar



5:06 am on May 27, 2005 (gmt 0)

10+ Year Member

I took over a website, and can't figure out how php calls get their date from the MySQL database date field, that is a varchar type. Specifically, an example I'm looking at has field=date, type=varchar(14) in the structue, and the data for the date field is 1094284800. When I do a php call to this field using the following script

echo "<b>". date("D. M. j", $events[$i]['date'])

it returns Sat. Sep. 4, which is correct. How does 1094284800 become this date? If I change it to 1094384800 it becomes Sun. Sep. 5. How is this possible, by simply changing one digit, and how can I change to other dates simply other than trial and error? Help! I'm REALLY new to MySQL and php. Thanks.


8:06 am on May 27, 2005 (gmt 0)

unix time [google.com]


11:58 am on May 27, 2005 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Welcome to WebmasterWorld, AKTigger99645.

What you are seeing is time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). The PHP Date and Time Functions [php.net] are another good resource.


9:20 pm on May 27, 2005 (gmt 0)

10+ Year Member

Thank you for the help. This answered my question.

Featured Threads

Hot Threads This Week

Hot Threads This Month