cheap nfl jerseys china cheap nfl jerseys free shipping wholesale nfl jerseys china wholesale jerseys from china cheap nfl jerseys free shipping cheap nfl jerseys for sale cheap jerseys free shipping wholesale nfl jerseys from china cheap nfl jerseys sale cheap nike nfl jerseys china wholesale jerseys free shipping cheap nfl jerseys wholesale wholesale nfl jerseys online cheap nfl jerseys wholesale china jerseys wholesale cheap coach handbags outlet authentic designer handbags cheap coach handbags outlet cheap coach purses outlet discount coach bags coach bags sale coach purse outlet cheap real coach purses coach handbags sale online coach purse outlet michael kors outlet online store cheap michael kors bags cheap michael kors purse michael kors factory outlet online cheap michael kors handbags cheap michael kors purses michael kors bags outlet online cheap michael kors purse michael kors handbags discount
MySQL & PHP

Insert, Update and Delete


5.1 Dealing with Time

MySQL has a 14 byte datetime type which is very useful. The format of it is yyyyMMddhhmmss where:

y = year
M = month
d = day
h = hours
m = minutes
s = seconds

So 19990317182330 works out to 6:23:30pm on March 17th, 1999.

Having this numeric format is very useful because you can numerically compare dates to see if one is earlier than the other. Having each digit be a month, day, year, etc. means that you can quickly and easily create these dates.

If you are requesting a date from a user, I'd highly recommend setting up a series of pulldown menus to build the date. One select field for each of the year, month, day, hour, etc. It's a lot of HTML to write out but it makes the backend code SO much easier. Just paste the multiple variables together in a string to create your date string.

    $datetime = $year.$month.$day.$hour.$min.$sec;
    

Note: There aren't any corrections for timezone, you'll need to do those on your own. It's difficult with most web applications because the browsers do not export what timezone they are from in the HTTP headers.

5.2 Questions? Comments?

If you have any questions, feel free to send me email at: rene@vtwebwizard.com. I can't promise I'll answer your questions but if I've got the spare time, I'll take a shot at it.

5.3 Consulting Services

Of course, part of the reason I put this little tutorial together is to help advertise my own consulting services. Please take a look around the rest of my website if you have a project that you think I could assist you on, please let me know.

Back Index Next Chapter

Vt. Web Wizard Home    |     Email Questions & Comments

© 1998 Vt. Web Wizard