03-27-2023 03:52 PM - last edited on 05-02-2023 10:03 AM by JackLacava
Hi,
I have an application DB table with a date column and I am using the LoadCustomTableUsingDelimitedFile function to load a CSV file to the table. The xfDateTime# token is assigned to the column in the LoadCustomTableUsingDelimitedFile function.
The dates in the CSV file are in the dd-mm-yyyy format. However, the LoadCustomTableUsingDelimitedFile function assume the dates are in the mm-dd-yyyy format. Data is loaded but when querying the table using the Month() SQL function for example, the day is return instead.
Is there a way to make sure LoadCustomTableUsingDelimitedFile knows the date column in the data file is in the dd-mm-yyyy format?
Thank you
Solved! Go to Solution.
03-28-2023 11:04 AM
The workaround I have come up with is to recreate the application table by making sure the date column is in fact of varchar type. Then I have updated the LoadCustomTableUsingDelimitedFile function to use the xfText# token for that column. When querying the table, for example to insert the value to a date column of another table, I am using the "CONVERT(datetime, ColumnName, 105)" SQL function, where the 105 represent the date style dd-mm-yyyy.
03-28-2023 01:29 PM
no, but the first parameter, si, is a session object representing a logged-in user, and it has a .Culture property that contains the user's culture setting. So in theory, one could open a brand new connection through the client api using a different user (who would have a different culture), and then pass that si object to the call. But it's a lot of work.
03-28-2023 11:04 AM
The workaround I have come up with is to recreate the application table by making sure the date column is in fact of varchar type. Then I have updated the LoadCustomTableUsingDelimitedFile function to use the xfText# token for that column. When querying the table, for example to insert the value to a date column of another table, I am using the "CONVERT(datetime, ColumnName, 105)" SQL function, where the 105 represent the date style dd-mm-yyyy.
03-28-2023 11:58 AM
I suspect another workaround would be to obtain a sessionInfo object with culture settings different from the default (US), and then pass that to the function.
03-28-2023 01:16 PM
Hi, thank you for your reply. As far as I can see the LoadCustomTableUsingDelimitedFile function does not have a parameter for the culture setting, so I cannot pass that to the function.
03-28-2023 01:29 PM
no, but the first parameter, si, is a session object representing a logged-in user, and it has a .Culture property that contains the user's culture setting. So in theory, one could open a brand new connection through the client api using a different user (who would have a different culture), and then pass that si object to the call. But it's a lot of work.
03-28-2023 02:21 PM
That is a clever solution! Thank you for the explanation.