|
-
Mar 10th, 2007, 11:05 AM
#11
Re: Problem with DTPicker and dates
Good stuff, let us know if it goes wrong later!
 Originally Posted by VB rookie
if how i put them into the DB matters, why do I not get the errors on my machine, yet get them on his machine?
It's all about the date format settings on that computer - presumably yours are different to his.
Whenever you use a function to convert to/from a date (such as DateValue, Str), or convert without using a function at all (eg: StringVariable = DateVariable) VB makes assumptions of how dates should be formatted, and thus converted - based on the computers regional settings.
When converting a Date to a String you should use the Format function, as you can be sure the format will be correct - but this String cannot be converted back to a Date unless it is the same format as the computer settings (otherwise VB will read it the wrong way, and give you the wrong date - as in my 9/3/2007 example).
You could write your own function to convert a formatted String to a Date, but as you can use a control like the DTP there isn't much point - it does all the work for you (as well as checking the date is valid etc).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|