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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem converting date stored as text to data/time format

Status
Not open for further replies.

gddrew

MIS
Dec 13, 2001
11
US
I have a problem converting text to a real date value so I can do some calculations. I have a query that brings in data from an external data source. It appears the data is stored in the external table in text format and looks like this:

20050902 15:40:41

I have tried CDate to convert the text to a date/time format, but no luck. Any ideas?
 
Is this in Excel?

[tt]_____
[blue]-John[/blue]
[/tt][red]Quidquid latine dictum sit, altum viditur[/red]

Help us help you. Please read FAQ181-2886 before posting.
 


FYI

Why do Dates and Times seem to be so much trouble? faq68-5827

I'd edit the query; something like...
Code:
Select ...., DateSerial(Year(Left(DS,4),Mid(DS,5,2),Mid(DS,7,2))+ TimeSerial() As 'TheDate', ...
and you can figger out the time parsing for hour, minute and second.

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Nevermind, I guess the CDate should have tipped me off that it isn't Excel.

[tt]_____
[blue]-John[/blue]
[/tt][red]Quidquid latine dictum sit, altum viditur[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top