<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Storing DateTime in database</title><link>https://answers.axonivy.com/questions/1238/storing-datetime-in-database</link><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;we use database (sqlserver) to store values.
One of those field is an ivy DateTime.
When we try to store it in the database we have this error :&lt;/p&gt;
&lt;p&gt;com.microsoft.sqlserver.jdbc.SQLServerException: The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)&lt;/p&gt;
&lt;p&gt;The ivy field is a ch.ivyteam.ivy.scripting.objects.DateTime and it must be stored in a smalldatetime filed from sqlserver (10.50.4000.0).&lt;/p&gt;
&lt;p&gt;What are we doing wrong ?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1238/storing-datetime-in-database" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 25 Mar 2015 16:34:53 -0400</lastBuildDate><item><title>Answer by Peter Stöckli</title><link>https://answers.axonivy.com/questions/1238/storing-datetime-in-database/1239</link><description>&lt;p&gt;Hi there&lt;/p&gt;
&lt;p&gt;Possibilities I could think of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Date is out of range for MS SQL. auto initialized DateTimes are '0001-01-01 00:00:00', but MS SQL accepts only a date between January 1, 1753 and December 31, 9999&lt;/li&gt;
&lt;li&gt;The language of the MS SQL user isn't english -&amp;gt; DateTime Format is different &lt;a href="https://msdn.microsoft.com/de-ch/library/ms174398%28v=sql.105%29.aspx"&gt;SET LANGUAGE&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Stöckli</dc:creator><pubDate>Wed, 25 Mar 2015 16:34:53 -0400</pubDate><guid>https://answers.axonivy.com/questions/1238/storing-datetime-in-database/1239</guid></item></channel></rss>