By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,716 Members | 1,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,716 IT Pros & Developers. It's quick & easy.

storing months in mysql 4

P: n/a
Hello, I'm using PHP 4 and MySQL 4. I want to store the month and year
as a single row but I am having difficulty figuring out the best data
type to use. I suppose I could use 'DATE' and then always have the day
value be equal fto 1, but I figure there's a more elegant approach. I
leave it to on e of you experts to recommend one.

Thanks in advance, - Dave

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
NC
laredotorn...@zipmail.com wrote:

I'm using PHP 4 and MySQL 4. I want to store the month and
year as a single row but I am having difficulty figuring out
the best data type to use.
The best for WHAT? How do you intend to use the data? What
typical computations will be performed on it? What will it
be routinely compared to?
I suppose I could use 'DATE' and then always have the day
value be equal fto 1, but I figure there's a more elegant
approach.


Again, depends on how you are going to use the data. Maybe
for your purposes it makes more sense to set the date to the
last day of the month...

Cheers,
NC

Jul 17 '05 #2

P: n/a
On 29 Apr 2005 06:16:41 -0700, la***********@zipmail.com wrote:
Hello, I'm using PHP 4 and MySQL 4. I want to store the month and year
as a single row but I am having difficulty figuring out the best data
type to use. I suppose I could use 'DATE' and then always have the day
value be equal fto 1, but I figure there's a more elegant approach. I
leave it to on e of you experts to recommend one.


In the past, I've stored the month as an int representing "months
since Jan 2000", or some other "beginning of time" date.

HTH.

--
David ( @priz.co.uk )
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.