- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 spring boot 和 thymeleaf 的新手。我确实尝试研究了一段时间,但无法让它发挥作用。我正在调用第 3 方 api,它返回一个对象,该对象在 unix 纪元时间戳中有一个字段。该值以 Long 形式返回。
在 thymeleaf 中,我在下面进行了尝试,但得到了一个完全不同的日期。时间戳是今天的。但是显示的日期是错误的。
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<!--<version>1.5.13.RELEASE</version> -->
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>
时代值(value)
1531879826
查看
<td th:text="${#dates.format(discount?.start, 'dd-MM-yyyy HH:mm:ss')}">date</td>
显示的日期是错误的。它应该是今天的日期/时间。
18-01-1970 12:31:19
感谢任何引导我朝着正确方向前进的帮助。
最佳答案
为了正确处理,您必须为纪元时间使用更长的值。在 Java 中,您需要将它乘以 1000,因为它使用的是毫秒。
我认为:
<td th:text="${#dates.format(discount?.start * 1000, 'dd-MM-yyyy HH:mm:ss')}">date</td>
会完成这项工作。
试一试。
关于spring boot 2.0 + thymeleaf unix 时代至今,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51411076/
我想通过添加一个带有 transition = 0s 的类但更改颜色来使用 jQuery 运行 CSS 动画,然后立即删除该类(使用原始 transition = 2s)它逐渐变为原始颜色。 下面是我
最近两年,互联网+的概念可谓十分火爆。所谓“互联网+”,其实质就是把互联网大平台和各行各业进行有机结合,建立一个新的商业生态,对于传统企业来说,互联网+的第一步就是有一个企业网站,将自己推广出去
每天我都更喜欢 Postgres,今天我发现了函数“age”。它不仅选择年份,还选择月份和日期。太棒了! 46 years 10 mons 18 days 现在我想知道是否有一个函数可以定义“年”、“
我正在 秒 内从服务器接收数据,我想将其转换为最新数据。 但我收到的秒数不是自 UNIX 纪元 01/01/1970 以来,而是 01/01/2000。 通常我会使用: SimpleDateForma
如果在 matlab 中使用可变时间步长求解器,例如 ODE45 - 我将为输出定义一个时间跨度,即 times = [0 50],matlab 将返回不同时间步长的结果介于 0 和 50 之间。 但
因此,System.currentTimeMillis 以 UTC 时区返回毫秒。 DateTime.getmillis 是否与我所知道的几乎所有图书馆都一样,因为纪元总是在 UTC 中? joda-
Hadoop 2.0 引入了 YARN,取代了 Job Tracker 和 Task Tracker 的任务。 YARN 由资源管理器(调度器、应用程序管理器...)、节点管理器和应用程序管理器组成。
在 ViewModel 和 one activity multiple fragments 概念时代,Activity 与 Fragment 中放置 Toasts、Snackbars 有什么建议。 很
许多 Android 讨论都集中在(显然是著名的)Fingerpaint 示例上: https://stackoverflow.com/a/16650524/294884 我从哪里得到它,与 Andr
在(最终)向我的 Facebook 应用程序添加一些分析并意识到英语在我的用户语言列表中排名靠后后,我开始研究 official docs on internationalization . 但是,文
我是一名优秀的程序员,十分优秀!