java 如何将日期作为 URL 参数传递

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28323895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 13:24:03  来源:igfitidea点击:

How to pass the date as URL parameter

javaweb-servicestitaniumsakai

提问by user3663712

I am using the titanium to create some app for a particular web application through a webservice.

我正在使用钛通过网络服务为特定的网络应用程序创建一些应用程序。

Here I am passing the date as a URL parameter to call a particular webservice method in java.And the date format is as like below

在这里,我将日期作为 URL 参数传递以调用 java 中的特定 webservice 方法。日期格式如下

2015-02-04T05:10:58+05:30

2015-02-04T05:10:58+05:30

In java service method the expecting parameter type as Date.So how can i send the above format of date through URL Parameter.

在java服务方法中,期望参数类型为Date.So如何通过URL参数发送上述日期格式。

回答by Rich Henry

You can encode the time string using the encodeURIComponentjavascript function.

您可以使用encodeURIComponentjavascript 函数对时间字符串进行编码。

encodeURIComponent("2015-02-04T05:10:58+05:30");

Results in..

结果是..

2015-02-04T05%3A10%3A58%2B05%3A30