• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

获取AEM 6.0服务器时间(Fetching AEM 6.0 Server Time)_电脑培训

原作者: [db:作者] 来自: 网络 收藏 邀请

获取AEM 6.0服务器时间(Fetching AEM 6.0 Server Time)

当网页用户点击该页面上的“ 提交”按钮时,我需要将当前时间戳作为隐藏输入类型发送到另一个页面。 我能够使用JSP Date()函数执行此操作,但它存储了本地计算机时间,因为我在localhost上使用AEM。
但是我想只在EST中发送当前时间戳,当表单在AEM服务器上而不是在localhost上托管时,这对于从任何地理位置点击提交按钮的所有用户都是通用的。

以下是存储本地时间的代码:
<% Date date = new Date(); %>
<input name="timeStamp" value="<%=date.toString()%>" type="hidden" />

PS我将AEM表格中的数据带到Eloqua,因此我想知道用户何时填写表格(在什么时间和日期)?

谢谢。


I need to send current time stamp as a hidden input type to another page when the user of the webpage hits Submit button on that page. I'm able to do so with JSP Date() function but it is storing my local machine time because I'm using AEM on localhost.
However I want to send current time stamp in only EST which will be universal to all users hitting the submit button from any geographical location when the form is hosted on AEM server and not on localhost.

Below is the code which is storing local time:
<% Date date = new Date(); %>
<input name="timeStamp" value="<%=date.toString()%>" type="hidden" />

P.S. I'm taking the data from AEM form to Eloqua and for that reason I want to know when did the user filled the form (at what time and date)?

Thanks.


原文:https://stackoverflow.com/questions/36848278
更新时间:2022-03-22 15:03

最满意答案

这几乎是一个Java问题。 如果要使用服务器端Java代码在特定时区获取日期,则应使用内置Java功能。

请参见如何设置java.util.Date的时区?

或者查看给定时区的转换日期/时间 - java


This is pretty much a Java question. If you want to get the date in a certain time zone using server-side Java code, you should use the built-in Java capabilities.

See How to set time zone of a java.util.Date?

Or see Convert Date/Time for given Timezone - java


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap