结果集getDate()方法返回的格式化Date对象的任何机会 [英] Any chance of formatting Date object returned by resultset getDate() method

查看:487
本文介绍了结果集getDate()方法返回的格式化Date对象的任何机会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想跳过日期的解析并设置其格式.相反,我直接想以自定义格式从数据库中获取日期.这可能吗?

I want to skip the parsing of date and formatting it. Instead i directly want to fetch the date from database in custom format. Is this possible ?

推荐答案

是的,更改您的SQL查询以格式化日期.例如,如果使用oracle,则需要使用函数TO_CHAR(dateColumn,'YYYY/MM/DD'),这将返回日期格式为'2012/09/14'的String列.

Yes, change your SQL query to format the date. For example, if you use oracle, you need to use the function TO_CHAR(dateColumn, 'YYYY/MM/DD'), and that will return a String column with the date formatted as '2012/09/14'.

这篇关于结果集getDate()方法返回的格式化Date对象的任何机会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆