Is it possible for PostgreSQL to support mmddyyyy date format?

Started by Bernard Bartonabout 17 years ago2 messagesgeneral
Jump to latest
#1Bernard Barton
bfb21@comcast.net

I'm currently porting an Informix based application to PostgreSQL 8.3.
All of the dates processed by the application are in the mmddyyyy
format. According to the date input table at the link below, the
mmddyyyy format is not listed. The yyyymmdd format is supported, but
I'd have to modify a LOT of code to change the format, which I'm trying
to avoid. Is there any way to get PG to work with the mmddyyyy date
format? I know I can use the to_date function, but again, it would be
MUCH simpler if PG worked with this format.

-Thanks

http://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE

#2Justin
justin@emproshunts.com
In reply to: Bernard Barton (#1)
Re: Is it possible for PostgreSQL to support mmddyyyy date format?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="+1"><font face="Arial">This is from the link <br>
</font></font>
<table class="CALSTABLE" border="1">
<tbody>
<tr>
<td>1/8/1999</td>
<td>January 8 in <tt class="LITERAL">MDY</tt> mode; August 1 in <tt
class="LITERAL">DMY</tt> mode</td>
</tr>
<tr>
<td>1/18/1999</td>
<td>January 18 in <tt class="LITERAL">MDY</tt> mode; rejected in
other modes</td>
</tr>
<tr>
<td>01/02/03</td>
<td>January 2, 2003 in <tt class="LITERAL">MDY</tt> mode;
February 1, 2003 in <tt class="LITERAL">DMY</tt> mode; February 3,
2001 in <tt class="LITERAL">YMD</tt> mode</td>
</tr>
</tbody>
</table>
<br>
&nbsp;<font size="+1"><font face="Arial">you can run this <br>
<br>
select '01/01/2009'::date, '01-01-2009'::date<br>
<br>
You can change the output&nbsp; for the client..<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-DATESTYLE&quot;&gt;http://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-DATESTYLE&lt;/a&gt;&lt;br&gt;
</font></font><br>
Bernard Barton wrote:. <br>
<blockquote cite="mid:49DD2E52.7040303@comcast.net" type="cite">
<pre wrap="">I'm currently porting an Informix based application to PostgreSQL 8.3.
All of the dates processed by the application are in the mmddyyyy
format. According to the date input table at the link below, the
mmddyyyy format is not listed. The yyyymmdd format is supported, but
I'd have to modify a LOT of code to change the format, which I'm trying
to avoid. Is there any way to get PG to work with the mmddyyyy date
format? I know I can use the to_date function, but again, it would be
MUCH simpler if PG worked with this format.

-Thanks

<a class="moz-txt-link-freetext" href="http://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE&quot;&gt;http://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE&lt;/a&gt;

</pre>
</blockquote>
</body>
</html>