Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange Date Conversion

Status
Not open for further replies.

NiceArms

Programmer
May 21, 2009
105
GB
Hey,

I am pulling a date from the database which has a data type of varchar(50) and with the use of flat connection file manager I am exporting the data into a .csv. the data in the varchar(50) is a date presented as dd/mm/yyyy but the date is converting to yyyy-mm-dd 00:00:000 when exported. I have checked the data type on the flat connection file manager and it is set up as string!

I am confused as to why the date is being converted when I am passing string type dd/mm/yyyy to another string type and getting yyyy-mm-dd 00:00:000.

I am not touching the data in anyway between the extract from the database to the flat file.

/nice

I feel sorry for people who don't drink, when they wake up in the morning that's as good as the're going to feel all day!
 
It appears to be returning the default format of the DATETIME data type. Use CONVERT(VARCHAR(12), Field1, 101) to return a MM/dd/yyyy format.

CONVERT supports several different date formats and would recommend looking at the help file to fine the one that best fits your needs.

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------
 
You don't show us the query you are using to pull the data, it could be the query/process is converting the varchar value to datetime value.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top