What's the best way to put a date into a database? - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Databases - MySQL, SQL, Oracle, Access and others

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-22-2009, 07:19 PM   #1 (permalink)
Junior Member
 
Join Date: Jun 2009
Posts: 6
Default What's the best way to put a date into a database?

What's the best way to put a date (like 11-10-2009) into a MYSQL database so that later I can get the day, month, and year separately instead of just a text string with the whole thing?
Should I create a table field for each one? Should I make it into a text string like
"11-10-09" and then later "explode()" it into an array? (I'm using PHP)
srsdude is offline   Reply With Quote
Sponsored Links
Old 08-04-2010, 03:05 AM   #2 (permalink)
Junior Member
 
manzar's Avatar
 
Join Date: Jul 2010
Posts: 53
Default Re: What's the best way to put a date into a database?

all date calculations are done using the YYYY-MM-DD format (MySQL DATE format).

you to leave the DATE format in the db as it is, so you can do calculations, searches etc. Only re-format the date to your required format when displaying it to the user using the DATE_FORMAT MySQL command:

DATE_FORMAT(your_date, "%d-%e-%Y")
manzar is offline   Reply With Quote
Old 08-11-2010, 03:35 AM   #3 (permalink)
Regular User
 
Join Date: Apr 2010
Posts: 173
Default Re: What's the best way to put a date into a database?

Something useful information to all!!!!
shanthi is offline   Reply With Quote
Old 08-13-2010, 03:06 AM   #4 (permalink)
Junior Member
 
Join Date: Sep 2009
Posts: 20
Default Re: What's the best way to put a date into a database?

dexter dvd box set does not disappoint. Based on the novels of Jeff Lindsay, dexter dvd box set is the story of a serial killer who murders other serial killers. While yes he is a sociopath, I find that one of the most fascinating parts of both the novels and the Showtime series is that slowly dexter dvd box set is starting to show that he may even be developing emotions.
ann1985 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 10:15 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting