Connecting Tech Pros Worldwide Help | Site Map

storing months in mysql 4

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:55 PM
laredotornado@zipmail.com
Guest
 
Posts: n/a
Default storing months in mysql 4

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


  #2  
Old July 17th, 2005, 12:55 PM
NC
Guest
 
Posts: n/a
Default Re: storing months in mysql 4

laredotorn...@zipmail.com wrote:[color=blue]
>
> 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.[/color]

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?
[color=blue]
> 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.[/color]

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

  #3  
Old July 17th, 2005, 12:57 PM
David Mackenzie
Guest
 
Posts: n/a
Default Re: storing months in mysql 4

On 29 Apr 2005 06:16:41 -0700, laredotornado@zipmail.com wrote:
[color=blue]
>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.[/color]

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 )
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.