473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Convert Text To Date

65
Hi,

I've got a field in textformat with a date that looks like this: 2005-01-03 22:43:19.65
Now I need to move this field to another field in date format. So far I tried to use IsDate() that gives 31/12/1899 and CVDate() which returns empty. I need the format displayed by IsDate() but I need the correct one ofcourse :)

Greetz
Twanne
Aug 6 '07 #1
3 3552
missinglinq
3,532 Expert 2GB
You say IsDate() gives you 31/12/1899. This is somewhat confusing, because IsDate() doesn't return a date of any kind, it returns True or False, depending on whether the expression it's asked to evaluate can be interpreted as a date or not! 31/12/1899 is what Access defaults to if you try to stuff a non-date in a date defined field, which I guess is why you're getting it; you're passing "False" to a date field!

Is the string always in this exact format, character for character?

Are you trying to retrieve the date and time or just the date portion?

Is this going to be an ongoing thing, getting "dates" in this fashion, or are you just trying to do a one time conversion?

What format do you want the date in; I seem to recall that your version of Access is in Dutch?

Linq ;0)>
Aug 6 '07 #2
Twanne
65
Hey,
I've let it rest for a while but i'm back now :)

The format for this as always the same indeed (2006-10-03 09:26:00.0). But the thing is I get some data from a centralized db send to me in excell. The centralized system uses this type of dates. Now I can import the date's from excell to access using the import worksheet function (or somthing in that trend) and that works. But, like it should be, it puts the dates in text format. No problem there so far. But how do I get it from that text format into a date formated field??

I'd like to do this in sql itself because I know it is possible. I've found some ways around it in vba but they are to complex and not aplicable to other dates that aren't stored in the same way. There should be some kind of consistency, right...

Yeah I know I'm getting frustrated about dates in access, if I could use php or java is wouldn't be a problem.

Greetz

Twanne

If dates are changing in the blink of an eye, what is time doing then?
Sep 6 '07 #3
Twanne
65
Ok, so far I've tried CVDate(), CDate(), Dateformat(), Datevalue(),... some other to, But nothing seems to work.

My query looks like this:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO Behandelingen ( dkey, eadnr, eersteZendtijd, cnr, verslagNr, klasse, behandeling, vorm, route, dosis, aantalKeer, per, start, stop, opmerking, onderhoud )
  2. SELECT ExportBehandelingen.dkey, ExportBehandelingen.eadnr, (CDate(ExportBehandelingen.eersteZendtijd)) AS Datum, ExportBehandelingen.cnr, ExportBehandelingen.verslagNr, ExportBehandelingen.klasse, ExportBehandelingen.behandeling, ExportBehandelingen.vorm, ExportBehandelingen.route, ExportBehandelingen.dosis, ExportBehandelingen.[#keer], ExportBehandelingen.per, ExportBehandelingen.start, ExportBehandelingen.stop, ExportBehandelingen.opmerking, ExportBehandelingen.onderhoud
  3. FROM ExportBehandelingen
  4. WHERE (((ExportBehandelingen.dkey) Not In (SELECT dkey FROM Behandelingen)) AND ((ExportBehandelingen.verslagNr) Not In (SELECT verslagNr FROM Behandelingen)) AND ((ExportBehandelingen.omit)="i"));
The field ExportBehandelingen.eersteZendtijd is in text format, the field that receives the value is in date format. How do I convert this so It doesn't give an error (#NAME?)
The ExportBehandelingen.eersteZendtijd is still in the same format as I said before.

Greetz
Twanne

While my head is getting empty my brain is getting full.
Sep 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Loi Tan Vo | last post by:
Hi, I have a text file that contains a date column. The text file will be imported to database in SQL 2000 server. After to be imported, I want to convert the date column to date type. For...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
1
by: Num | last post by:
Hi all, I have to convert a J2EE date as a long ("Millis") in a .NET date as a long ("Ticks") In Java, currentTimeMillis, is the difference, measured in milliseconds, between the current time...
17
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
0
by: santoshpayal | last post by:
Hi, I have a text file that contains a date column. The text file will be imported to database in SQL 2000 server. After to be importing, I want to convert the date column to date type. For...
2
by: santoshpayal | last post by:
Hi, I have a text file that contains a date column. The text file will be imported to database in SQL 2000 server. After to be importing, I want to convert the date column to date type. For...
1
by: Beckster6701 | last post by:
I have a MSAccess database that is linked to a SQL server. I cannot change the SQL server datatype as I am not the only one that uses the database. I'm trying to convert the text field to a valid...
2
by: Kakishev | last post by:
I have a problem at how best to convert a Date into a text field and keep the format dd/mmm/yyyy (01-FEB-2007). The problem is that dates are imported from SQL into an access front end Database....
2
by: thewilldog | last post by:
Hello, I've reviewed the archives here to address the issue, but I'm still running into problems. I've got a table field populated with the record date in text "YYYYMMDD" To convert it into a...
4
by: RP | last post by:
I am using SQL Server 2005 as backend. I have a Text Box that accepts Date in the format dd-MM-yyyy. But when I attempt to insert a record, an error is displayed: Cannot convert char to DateTime...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.