- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
想知道它们是否代表不同的格式或本质上相同(只是新与旧的演示文稿)。
最佳答案
Offset X and x: This formats the offset based on the number of pattern letters.
-One letter outputs just the hour, such as '+01', unless the minute is non-zero in which case the minute is also output, such as '+0130'.
-Two letters outputs the hour and minute, without a colon, such as '+0130'.
-Three letters outputs the hour and minute, with a colon, such as '+01:30'.
-Four letters outputs the hour and minute and optional second, without a colon, such as '+013015'.
-Five letters outputs the hour and minute and optional second, with a colon, such as '+01:30:15'.
-Six or more letters throws IllegalArgumentException. Pattern letter 'X' (upper case) will output 'Z' when the offset to be output would be zero, whereas pattern letter 'x' (lower case) will output '+00', '+0000', or '+00:00'.Offset Z: This formats the offset based on the number of pattern letters.
-One, two or three letters outputs the hour and minute, without a colon, such as '+0130'. The output will be '+0000' when the offset is zero.
-Four letters outputs the full form of localized offset, equivalent to four letters of Offset-O. The output will be the corresponding localized offset text if the offset is zero.
-Five letters outputs the hour, minute, with optional second if non-zero, with colon. It outputs 'Z' if the offset is zero.
-Six or more letters throws IllegalArgumentException.
代码:
public static void printDate(Temporal t, String format) {
System.out.println(DateTimeFormatter.ofPattern(format).format(t));
}
public static void testJavaTime() {
ZonedDateTime zdt = ZonedDateTime.now();
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSZ"); //2019-10-14 08:15:53.115+0200
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSZZ"); //2019-10-14 08:15:53.115+0200
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSZZZ"); //2019-10-14 08:15:53.115+0200
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSZZZZ"); //2019-10-14 08:15:53.115GMT+02:00
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSZZZZZ"); //2019-10-14 08:15:53.115+02:00
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSX"); //2019-10-14 08:15:53.115+02
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSXX"); //2019-10-14 08:15:53.115+0200
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSXXX"); //2019-10-14 08:15:53.115+02:00
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSXXXX"); //2019-10-14 08:15:53.115+0200
printDate(zdt, "yyyy-MM-dd HH:mm:ss.SSSXXXXX"); //2019-10-14 08:15:53.115+02:00
}
<小时/>
基于SimpleDateFormat
,这是一个简单的可能格式问题:
Z Time zone RFC 822 time zone -0800
X Time zone ISO 8601 time zone -08; -0800; -08:00
无论Z
的数量是多少,它总是使用[-+]####
格式但对于 X
来说,情况就不同了。
X
: [-+]##
XX
:[-+]####
XXX
:[-+]##:##
现在,让我们演示一下:
public static void printDate(Date d, String format){
System.out.println(new SimpleDateFormat(format).format(d));
}
public static void testJavaDate() {
Date d = new Date();
printDate(d, "yyyy-MM-dd HH:mm:ss.SSSZ"); //2019-10-14 07:52:10.308+0200
printDate(d, "yyyy-MM-dd HH:mm:ss.SSSZZ"); //2019-10-14 07:52:10.308+0200
printDate(d, "yyyy-MM-dd HH:mm:ss.SSSZZZ"); //2019-10-14 07:52:10.308+0200
printDate(d, "yyyy-MM-dd HH:mm:ss.SSSX"); //2019-10-14 07:52:10.308+02
printDate(d, "yyyy-MM-dd HH:mm:ss.SSSXX"); //2019-10-14 07:52:10.308+0200
printDate(d, "yyyy-MM-dd HH:mm:ss.SSSXXX"); //2019-10-14 07:52:10.308+02:00
}
关于java - yyyy-MM-dd'T'HH :mm:ss. SSSZZ 和 yyyy-MM-dd'T'HH :mm:ss. SSSXXX 之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58370435/
我有两个 javascript 变量(它们来自文本框,所以它们可能被评估为字符串),格式如下:02:30 和 4:45 它们代表小时和分钟。 我想将它们加在一起得到 07:15,但我无法计算出来。 最
我有时间数据库,我想获得时间序列数据的每小时平均值。 示例数据: 1 -1.64 2007-09-29 00:01:09 2 -1.76 2007-09-29 00:03:09 3
我有一个项目,其中使用 Bison 来生成解析器。项目本身是用 SCons 构建的,我的所有代码都是用 C++ 编写的。我一开始就决定将代码分成 3 个主要目录:includes、src 和 test
我正在尝试编写一个将返回当前时间的 SQL 查询,如下所示: HH:MM - HH:MM (+1) 例如如果时间是 14:00,它将返回 14:00 - 15:00 我已经设法做到了以下几点: SEL
关闭。这个问题需要更多focused 。它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 已关闭 3 年前。 Improve this qu
这是我的原始代码- String dateString = "23 Dec 2015 1:4 PM"; Locale locale = new Locale("en_US"); SimpleDateF
我们正在访问允许我们安排日期/时间的 API。我们需要检查预定的事情,这样我们就不会在同一时间重复预订。 API 返回的时间与军事中的 HH 一样。但是,它使用的是 UTC HH。因此,如果我们在下午
final String sourceDate = "05.12.2014 12:17"; final String testDate = "05.12.2014 13:17"; fi
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 7 年前。 Improve t
kk:mm、HH:mm 和 hh:mm 格式有什么区别?? SimpleDateFormat broken = new SimpleDateFormat("kk:mm:ss"); br
在单元格 B239 中,我有 37:15,代表某人完成一项任务所花费的总小时数。在单元格 C239 中,我有以下公式 =INT(B239)*24+小时(B239)+圆形(分钟(B239)/60,2)
我需要在从 HH: 05 到 HH: 59 的时间每小时列出 MAX () 温度 我有 mySQL 代码: SELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(
我正在使用 PHP 和 MySQL。如何将格式为 HH:MM AM/PM 的时间转换为 HH:MM:SS 以节省 MySQL 的时间? 最佳答案 使用 strtotime 将其转换为时间戳,然后使用
我想知道是否可以使用 moment.js 将 sql TIME (HH:mm:ss) 转换为 HH:mm。或者也许有一个简单的 JavaScript/jQuery 解决方案? 最佳答案 是的,你可以:
我正在寻找一个正则表达式来匹配不同的时间格式(用于时间跟踪网络应用程序)在 javascript 中。用户可以使用以下格式之一插入时间: h hh:mm hh.mm 我可以很容易地创建一个正则表达式来
我们如何在java中比较日期并获取剩余的可用插槽? Sun 10:00-11:00 Sun 12:00-14:00 Sun 15:00-16:00 那么除了这三个时段之外,我们如何才能获得一天中的所有
如何在 SQL Server 中将 hh:mm:ss 转换为 hh:mm? select Count(Page) as VisitingCount,Page,CONVERT(VARCHAR(8),Da
假设我的时间是 13:45。 现在我想使用 moment.js 将其转换为 13:45:00。 我在做moment('13:45').format('h:m:s'); 但它不起作用。 最佳答案 使用m
我想将时间从 hh:mm:ss 转换为 hh:mm它以 hh:mm:ss 的形式来自数据库(我的 sql)。我尝试了以下代码,但没有得到我想要的。 try { s= Hibernat
我希望这对某人来说是小菜一碟!目前,所有内容的字符串输出均为上午 12:00。 以下来自 MySQL 的代码,格式为 HH:MM:SS (hours_open, hours_close) $get_h
我是一名优秀的程序员,十分优秀!