homepage Welcome to WebmasterWorld Guest from 174.129.76.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
MySQL varchar and dates
Date format using varchar
AKTigger99645

5+ Year Member



 
Msg#: 8395 posted 5:06 am on May 27, 2005 (gmt 0)

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.

 

dcrombie

10+ Year Member



 
Msg#: 8395 posted 8:06 am on May 27, 2005 (gmt 0)

unix time [google.com]

coopster

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



 
Msg#: 8395 posted 11:58 am on May 27, 2005 (gmt 0)

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.

AKTigger99645

5+ Year Member



 
Msg#: 8395 posted 9:20 pm on May 27, 2005 (gmt 0)

Thank you for the help. This answered my question.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved