How to Format the Date on MS SQL servers with Non-US Local Settings

Last Updated: Dec 07, 2018 01:06PM EST

The Issue

If you ever experience an error similar to the following: “Syntax error converting datetime from character string”, you should know that it typically indicates that your MS SQL server is not using the US settings (e.g. when the software was installed, different local settings were used).

ProductCart converts all dates to MM/DD/YY by default before they are saved into the database. This causes a problem as the server is instead expecting dates in the DD/MM/YY format.
 

The Solution

To fix this, download and open the file includes/SQLFormat.txt using Notepad. Change the line:

private const SQL_Format="0"

to


private const SQL_Format="1"

Save the file and upload it back to your Web server.

This tells ProductCart to convert the date to DD/MM/YY prior to inserting it into the database, and should fix the error that you were receiving.

Menu

  • Support Forums
  • Video Tutorials
  • Support Request
  • Support Policy
647e99095133bd6d1ae916f97dc7f92f@productcart.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete