简体   繁体   English

如何将日期 2019 年 11 月 8 日转换为 11/08/19

[英]How to convert Date November 8 2019 to 11/08/19

您能否让我知道如何在 Oracle SQL 语句中将 2019 年 11 月 8 日转换为 11/08/19

The Oracle DATE type is stored internally as a numeric value (not to be confused with the NUMBER type). Oracle DATE类型在内部存储为数值(不要与NUMBER类型混淆)。 Consequently, an Oracle DATE has no format and it does not make sense to talk about converting a DATE from one format to another.因此,Oracle DATE没有格式,谈论将DATE从一种格式转换为另一种格式是没有意义的。

So, what you are asking about is how to convert a string representation of a particular date from one format to another.因此,您要问的是如何将特定日期的字符串表示形式从一种格式转换为另一种格式。 The answer is to first convert the input string to a DATE using the input string's format and then convert the resulting DATE back to a string using the desired output format.答案是第一转换输入字符串到DATE使用输入字符串的格式,然后将转换所得DATE使用希望的输出格式回字符串。

Like this:像这样:

select to_char(to_date('November 8 2019','MONTH DD YYYY'),'MM/DD/YY') from dual;

暂无
暂无

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

相关问题 如何在 PostgreSQL 中将 String(Example: 2/May/19, 24/4/19, 2019/4/20) 转换为 Date? - How to convert String(Example: 2/May/19, 24/4/19, 2019/4/20) to Date in PostgreSQL? 将字符串转换为 oracle sql 时间戳 Mon Aug 19 2019 08:21:48 GMT-0700 (PDT) - convert a string to oracle sql timestamp Mon Aug 19 2019 08:21:48 GMT-0700 (PDT) 如何从当前日期比较 sql 数据库的 dateandtime 字段,其中 dateandtime 在 2019 年 6 月 6 日上午 11 点 19 分在 MYSQL 中此格式 - How to Compare dateandtime field of sql database from current date where dateandtime is in June 06, 2019 at 11:19AM this format in MYSQL 将文本日期转换为年+月以进行排序(即1/19/2019到201901) - convert text date to year+month for sorting (ie, 1/19/2019 to 201901) SQL-将月份字符串'08 -2019'转换为时间戳数据类型-01-08-2019 - SQL - convert month string '08-2019' to timestamp datatype - 01-08-2019 转换nvarchar为datetime-格式19/02/2019 12.00.00 AM - Convert nvarchar to datetime - format 19/02/2019 12.00.00 AM MySQL:如何过滤格式为2011-11-29 19:30:00的日期并提取月份 - MySQL: How to filter date of format 2011-11-29 19:30:00 and extract the month 如何使用 PATINDEX 将 SQL 中的日期 15-May-2019 转换为 2019/05/15 - How to convert a date 15-May-2019 in SQL to 2019/05/15 using PATINDEX Presto:将 vachar 转换为日期时间 2019-03-01 08:13:50,704 - Presto: Convert vachar to datetime 2019-03-01 08:13:50,704 如何将 2020-08-20T12:02:02Z 日期转换为 DD-MM-YYYY sql? - How to convert 2020-08-20T12:02:02Z date into DD-MM-YYYY sql?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM