简体   繁体   English

来自 Oracle 的 xml 中的日期时间格式

[英]Datetime format in xml from Oracle

I have a simple requirement to display a time field as a Datetime in xml when converted from excel.我有一个简单的要求,即在从 excel 转换时将时间字段显示为 xml 中的日期时间。 Being new to Oracle field, I'm stuck with a few questions作为 Oracle 领域的新手,我被几个问题困住了

  1. When I run the below query in Oracle my value is displayed as 31-DEC-99 07.45.30.000000000当我在 Oracle 中运行以下查询时,我的值显示为 31-DEC-99 07.45.30.000000000

    select to_timestamp('1899-12-31 07:45:30', 'yyyy-mm-dd hh:mi:ss') as res from dual;

Now,I understand that my NLS_DATE_FORMAT = 'DD-MON-RR' and hence the date is shown as 31-DEC-99 but why is the time shown as hh.mm.ss.ffff rather than hh:mm:ss:ffff现在,我知道我的 NLS_DATE_FORMAT = 'DD-MON-RR' 因此日期显示为 31-DEC-99 但为什么时间显示为 hh.mm.ss.ffff 而不是 hh:mm:ss:ffff

  1. Is this the reason that when I download this simple file from oracle to excel and convert to xml, the datatype is show as string rather than datetime .这就是当我从 oracle 下载这个简单文件到 excel 并转换为 xml 时,数据类型显示为 string 而不是 datetime 的原因。 I tried a similar exercise directly on excel and we can see the value as datetime on xml but this doesnt work with excel downloaded from oracle.我直接在 excel 上尝试了类似的练习,我们可以在 xml 上看到该值作为日期时间,但这不适用于从 oracle 下载的 excel。 Where am I going wrong?我哪里错了?

在此处输入图片说明

Just to confirm, my requirement here is to get a timestamp displayed in excel properly when downloaded from oracle table and display the same as a datetime field when I open in xml只是为了确认,我的要求是在从 oracle 表下载时在 excel 中正确显示时间戳,并在我在 xml 中打开时显示与日期时间字段相同的时间戳

Is this concerning a BI/XML Publisher report?这是否与 BI/XML Publisher 报告有关? If so, you need to do something like this to your dates in your data definition:如果是这样,您需要对数据定义中的日期执行以下操作:

TO_CHAR(ORDERED_DATE,'MM-DD-YYYY  HH24:MI:SS') ORDERED_DATE

Realised it was the NLS_DATETIME_FORMAT that I had to worry about.意识到这是我不得不担心的 NLS_DATETIME_FORMAT。 Changed that for my session and worked like a charm.为我的会话更改了它,并且像魅力一样工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Oracle中用于DateTime格式的标准差函数 - Standard deviation function in oracle for DateTime format 如何更改使用Perl中的DateTime :: Format :: Excel模块以数字格式存储的,从XML文件中检索到的Date值的语言 - How to change the language of Date value retrieved from XML file which was stored in number format using DateTime::Format::Excel module in Perl 如何将 oracle 数据库响应中的日期时间戳 (1899-12-30T00:00:00.000+0000) 转换为 vba 中的 dd-mm-yyyy 格式 - How to convert datetime stamp (1899-12-30T00:00:00.000+0000) from the oracle db response into dd-mm-yyyy format in vba 有没有办法从熊猫的日期时间列设置周数/年格式 - Is there a way to set weeknumber/year format from a datetime column in pandas 选择查询以从Excel文件中获取日期时间值的任何格式 - Select query to get the any format of datetime value from the Excel file 从Excel导出XML并保留日期格式 - Exporting XML from Excel and Keeping Date Format Excel XML,如何获取Excel以yyyy-MM-dd格式显示DateTime字段? - Excel XML, how can I get Excel to display my DateTime field in yyyy-MM-dd format? 将字符串格式化为日期时间 - Format string to Datetime Excel中缺少DateTime格式 - DateTime format missing in Excel 如何从MySQL数据库中的datetime格式转换为正常的am / pm格式? - How to convert from datetime format in mysql databse into normal am/pm format?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM