# Default date format incompatible with my MS SQL Date Format

**URL:** <https://community.dreamfactory.com/t/default-date-format-incompatible-with-my-ms-sql-date-format/4009>\
**Category:** Schema & Data\
**Created:** [August 23, 2017, 3:37am UTC](https://community.dreamfactory.com/t/default-date-format-incompatible-with-my-ms-sql-date-format/4009 "2017-08-23T03:37:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam-Amin](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@Sam-Amin](https://community.dreamfactory.com/u/Sam-Amin)\
**Post date:** [August 23, 2017, 3:37am UTC](https://community.dreamfactory.com/t/default-date-format-incompatible-with-my-ms-sql-date-format/4009/1 "2017-08-23T03:37:51Z")

</div>

Hi

I am running dm v2803, which is connected to a remote MS SQL server.  
The problem I have is that when I try to retrieve data from a table using date as a filter, I get a out of range error.

After looking at the response, it immediately became obvious to me what the error was: The api automatically formats my input, ‘14-08-2017’, into Y-m-d H:i:s format, which is rejected by my sql server as it is setup to function with the d-m-Y format.  
No matter how I format my input, the api always formats it into it’s own default date format.

I tried changing the timezone in my php.ini and env files to Europe/London, hoping the api would format it to my country’s standard, but it did not do anything.

Is there anyway i can force the api to either not format my input or allow me to choose the date format?

As a temporary solution I am currentelyretrieving the data using a sql procedure, so that the api is forced to treat it as I want.

Request URL

> [http://127.0.0.1/api/v2/myapi/\_table/InvoiceTables?fields=InvId%2C%20InvoiceDate&filter=InvoiceDate%20\>%2014-08-2017](http://127.0.0.1/api/v2/myapi/_table/InvoiceTables?fields=InvId%2C%20InvoiceDate&filter=InvoiceDate%20%3E%2014-08-2017)

Response Body

> {  
> “error”: {  
> “code”: 500,  
> “context”: null,  
> “message”: “Failed to retrieve records from ‘InvoiceTables’.\nSQLSTATE[22007]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value. (SQL: select count(1) as aggregate from [dbo].[InvoiceTables] where [InvoiceDate] \> 2017-08-14 00:00:00)”,  
> “status\_code”: 500  
> }  
> }
