简体   繁体   English

Web应用程序中的时间戳更改问题

[英]Timestamp change issue in web application

In my spring based web application, I am using spring and jackson jar for converting json-object conversion. 在基于spring的Web应用程序中,我使用spring和jackson jar来转换json-object转换。 Here I am facing a problem , one of my bean has a field java.util.Timestamp registerDate . 在这里我面临一个问题,我的一个bean有一个java.util.Timestamp registerDate字段。

From the form (using angular js )I am setting value as 2016-01-22 22:30:00 . 从形式(使用angular js),我将值设置为2016-01-22 22:30:00 But in my controller the field value changed to different one that is 2016-01-22 12:30:00 . 但是在我的控制器中,字段值更改为2016-01-22 12:30:00

Since the problem here is your timezone, what you can do is send the browser timezone ( get client time zone from browser ) along with your form data and in your server you can calculate the appropriate time in your controller. 由于这里的问题是您的时区,因此您可以将浏览器时区( 从浏览器获取客户端时区 )与表单数据一起发送,并且可以在服务器中计算控制器中的适当时间。 Another option is that you can simply pass the date as a String and then convert it when needed. 另一个选择是,您可以简单地将日期作为字符串传递,然后在需要时进行转换。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM