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 > yyyy-mm-dd format probs

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-23-04, 13:15
houndour houndour is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
yyyy-mm-dd format probs

I know very little SQL and I am using phpMyAdmin to upload a text file to my database.

The text file contains dates in the format d/m/yy (so 1st feb would be 1/2/04 without any leading zeros). And it appears that they have to be in yyyy-mm-dd format in the database.

How can I upload this text file so the dates will insert correctly into the date fields?

Is there some SQL code that can do this? However I did try to use SQL before to upload my text file, but couldn't get it working, hence the reason I got phpMyAdmin.

Thanks in advance.

Sam
Reply With Quote
  #2 (permalink)  
Old 06-23-04, 17:16
Steve T. Steve T. is offline
Registered User
 
Join Date: Sep 2003
Location: So. Cal. USA
Posts: 142
GGGGGgrrrrrrrr!!! Aaaaaarrrrrggghhhh!!! I have lost my long response to you 2x now because the system complained I was not logged in and then dumped my post.

In short to summarize, though... I had a similar problem HERE but it was the reverse. You may be able to use something like PHP's strtodate() function but I think you'd still have to use substr() to get the correct format.

If you are not a programmer, you can probably just use Word/Excel to split the dates into 3 columns, add preceding 0's and 19xx/20xx characters, rearrange columns to yyyymmdd order, and remove delimiters.

I hope this helps.
--ST
Reply With Quote
  #3 (permalink)  
Old 06-23-04, 17:31
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
Quote:
Originally Posted by Steve T.
GGGGGgrrrrrrrr!!! Aaaaaarrrrrggghhhh!!! I have lost my long response to you 2x now because the system complained I was not logged in and then dumped my post.
dbforums.com has been getting "corn-fused" a bit lately. Just because I'm a paranoid soul, I copy my response to the clipboard before I submit it. That helps to keep my blood presure down.

-PatP
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