GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Jul-2006, 14:00
rayees80 rayees80 is offline
New Member
 
Join Date: Jul 2006
Posts: 1
rayees80 is on a distinguished road

MySQL date help


Hi,
I have a situation to solve.
i have date stored in a table, not in a date format but in three different fields of type numeric. first is day, second is month, and third is year.
i want to compare dates in query.
Is is possible.
Thanks in advance.
  #2  
Old 04-Jul-2006, 20:13
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: MySQL date help


I don't know how involved the task you have to accomplish may be, but you can build those 3 values into a string, and then use it...
Code:
select concat( <year>, '-', <month>, '-', <day> ) from <table_with_values>;
...so I'm not sure if this will be the easiest method, nor do I know if a particular mysql/php function might be easier, but I created three separate values in one table, ran this select to a local variable, and then inserted the value to another table field with a date data-type, and it did fine.

What I would probably do is add another date-type field to the table, update the new field based on the concat() of the 3 values [to have a real date field] and then use the new date field in a query.

HTH.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit combo box and date time picker choice according to database created in folder shinyhui C++ Forum 0 22-Feb-2005 21:16
Limit combo box and date time picker choice according to database created in folder shinyhui MS Visual C++ / MFC Forum 0 22-Feb-2005 03:13
Rookie problem with date format cave monkey MySQL / PHP Forum 4 18-Mar-2004 09:41
Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More EyotaHosts Web Hosting Advertisements & Offers 0 28-Jun-2003 14:54

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:51.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.