title: Perhaps you need a different "datestyle" setting
body: <p>I have a table which have a column <strong>order_date</strong>  of date type.</p>
  
  <p>query:</p>
  
  <pre><code>INSERT INTO uni_data_temp(sale_order_item_code, 
              order_date, sale_order_item_status, tracking_number, dispatch_date, 
              user_id) VALUES ('1000932515',  cast('16/05/2015' as date), 'DISPATCHED', 'UNIPAYP1958141', '2015/05/20', '4')
  </code></pre>
  
  <p>when I am running this query it gives error:</p>
  
  <blockquote>
  <pre><code>ERROR: date/time field value out of range: "16/05/2015"
  SQL state: 22008
  Hint: Perhaps you need a different "datestyle" setting.
  Character: 380
  </code></pre>
  </blockquote>
  
  <p>then I changed the query </p>
  
  <pre><code>INSERT INTO uni_data_temp(sale_order_item_code, 
              order_date, sale_order_item_status, tracking_number, dispatch_date, 
              user_id) VALUES ('1000932515',  cast('2015/05/16' as date), 'DISPATCHED', 'UNIPAYP1958141', '2015/05/20', '4')
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>but my problem is my date may be in any style (yyyy/mm/dd or dd/mm/yyyy) how i can cast it according databse ?</p>
  
  <p>Any kind of date format convert into system  database.</p>
  
  <p>Thank You</p>