If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Need Help on Date issue!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-11-04, 10:28
aodat2 aodat2 is offline
Registered User
 
Join Date: Aug 2004
Posts: 1
Question Need Help on Date issue!

Hi there!

I really need some help on the current date issue that I am having.

I created a field in MySQL under TEXT format and stored my date there (DD/MM/YYYY). I know it's stupid to do that, but I did it and didn't think of it at that time.

Anyway, currently I need to sort the dates and could not figure out a way to convert those dates into SQL readable format (YYYY-MM-DD). What can I do? Does anyone know how to convert a TEXT field (DD/MM/YYYY) to the SQL readable format?

I seriously need help. If anyone out there knows how to do it, please help me out. I'm extremely desprate here!

By the way, I am programming in PHP. Thank you for your help!


Worried Guy.
Reply With Quote
  #2 (permalink)  
Old 08-11-04, 11:41
ealmiladi ealmiladi is offline
Registered User
 
Join Date: Aug 2004
Posts: 4
Your going to have to redo your date system. There is no way to change that that I know, sorry.
Reply With Quote
  #3 (permalink)  
Old 08-11-04, 19:08
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Code:
select foo
     , bar
     , concat_ws('-'
        , substring(textdate,7,4)
        , substring(textdate,4,2)
        , substring(textdate,1,2)) as realdate
  from yourtable
order
    by realdate
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On