[英]How to convert the string type data into date format in postgres?
Sorry i am new to postgres. 抱歉,我是Postgres的新手。
Servlet gives me Servlet给了我
UPDATED: string type in the form 07-Jul-2014 . 更新: 字符串类型,格式为07-Jul-2014 。
I have inserted some date in My db column using 我使用以下方法在“我的数据库”列中插入了一些日期
to_date('1963-09-01', 'YYYY-MM-DD')//my column is of Date type
So how can i convert 07-Jul-2014 into 2014-06-07 so that i can save into my tables? 那么如何将2014年7月7日转换为2014年6月7日,以便可以保存到表中?
Try this: 尝试这个:
to_date('07-Jul-2014', 'DD-Mon-YYYY'); Will return the result in Date format '2014-07-07'
Where '07-Jul-2014' is the string from your servlet. 其中“ 07-Jul-2014”是来自servlet的字符串。
Ref: http://www.postgresql.org/docs/current/static/functions-formatting.html 参考: http : //www.postgresql.org/docs/current/static/functions-formatting.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.