SQL 如何让日期时间在 oracle 中以军用时间显示?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/102881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get Datetime to display in military time in oracle?
提问by George Mauer
I am running some queries to track down a problem with our backup logs and would like to display datetime fields in 24-hour military time. Is there a simple way to do this? I've tried googling and could find nothing.
我正在运行一些查询以追踪备份日志的问题,并希望以 24 小时军用时间显示日期时间字段。有没有一种简单的方法可以做到这一点?我试过谷歌搜索,但一无所获。
回答by Joe Skora
回答by Matthew Watson
If you want all queries in your session to show the full datetime, then do
如果您希望会话中的所有查询都显示完整的日期时间,请执行
alter session set NLS_DATE_FORMAT='DD/MM/YYYY HH24:MI:SS'
at the start of your session.
在您的会话开始时。
回答by Grant Johnson
回答by Nick Craver
It's not oracle that determines the display of the date, it's the tool you're using to run queries. What are you using to display results? Then we can point you to the correct settings hopefully.
确定日期显示的不是 oracle,而是您用来运行查询的工具。你用什么来显示结果?然后我们可以为您指出正确的设置。