Click to See Complete Forum and Search --> : Dates In VB
Euphoric Rider
August 21st, 2001, 02:28 AM
Hello
I have a problem with dates in vb;
I have an application that querries and updates dates fields in an Access DataBase. I work with Windows in french. When I send an update request on a date field, the day and the month are sometimes swapped. Any Idea?
Regards
srinika
August 21st, 2001, 03:04 AM
Didn't u try the format command ?
Did u use different machines in which Date formats r different?
Check for the above and do some chanes necessary & see.
Good Luck
Srinika
raghu_nv
August 21st, 2001, 03:25 AM
If you are using SQL statement like "Update SomeTable where Datefield=datevalue' always specify datevalue in mm/dd/yyyy format (Access and MS Sql Server) .
For Ex: "update mytable set dtfield='" & format(date,"mm/dd/yyyy") & "' where dtfield='" & format(somedate,"mm/dd/yyyy") & "'"
If you are using Recordset.Update method use default VB date format (which is also system's date format)
hope this works
Euphoric Rider
August 21st, 2001, 04:21 AM
I've found a solution!!!
When I was using the following syntax, the used Date Format was the International One (mm/dd/yy);
"UPDATE t_Dates set Date_Field = date WHERE Date_Field = AnotherDate"
So, with the following code, the Date Format is the System's one (european in my case);
Qdf = Database.CreateQueryDef ("", "UPDATE t_Dates set Date_Field = date WHERE Date_Field = AnotherDate")
Qdf.Execute
That's It, Thanx.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.