Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear all,
I have an excel macro which retrieves data from SQL server. I have a SQL statement which combines 3 int fields of a table into a date field : mySQL = select cast(str(YearField)+'/'+str(monthField)+'/'+str(dayField) as datetime) as resultDate from myTable Then I use ADO connection and recordset for retrieving data. For example: if YearField = 2006, monthField = 2 , dayField = 23 then the outcome should be 2006-02-23 00:00:00.000 Now the problem comes. When I run the macro on a computer with "Short Date Format" "M/d/yyyy" in "Control Panel" - "Regional Options", there is no problem at all. But the date setting in the computer is "d/M/yyyy", the select statement fails. It would be not so convenient to check the date setting of every user's computer. Can anyone suggest a better way to do this? Any better way to do the conversion in the SQL statement? Thanks a lot! Ivan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Converting hijri date to gregorian date | Excel Discussion (Misc queries) | |||
Problem Converting date to month in text for use in pivot table | Excel Worksheet Functions | |||
Converting a date to a text field w/o converting it to a julian da | Excel Worksheet Functions | |||
converting date from a textbox to a date format | Excel Programming | |||
Converting a string date into a Excel Date | Excel Programming |