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

Convert a string variable to a date field

Status
Not open for further replies.

wvjim

Programmer
Jan 11, 2001
25
0
0
US
Well, I seem to be having problems with the simplest of things. I’m trying to convert a string (or numeric) fields to a date field so I can do date comparisons. I can provide the date as 20021125, 11/25/02, 11/25/2002, on and on. I found in my MSDN help library that I can enclose a filed in “#” signs to proved a date to a date field, however when I create a string as #11/25/02#, I get a type mismatch. I can move a literal of “#11/25/02#” to a date field and it works just fine. Sigh, just can’t quite figure out this number to string, string to date, split up a string into multiple fields.


 
Converting from the string to the Date you don't want to use the '#' signs.

s = "11/25/2002"
d = CDate(s)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top