English 中文(简体)
亚马逊地区 土库曼地区日 电话: java
原标题:Date for Amazon Turk REST Call java

我想打电话:

https://mechanicalturk.amazonaws.com/?Service=AWSMechanicalTurkRequester
&AWSAccessKeyId=[the Requester s Access Key ID]
&Version=2012-03-25
&Operation=ApproveRejectedAssignment
&Signature=[signature for this request]
&Timestamp=[your system s local time]
&AssignmentId=123RVWYBAZW00EXAMPLE456RVWYBAZW00EXAMPLE

我需要签名, 它需要格式 < code> YYYYY: dd: MMTHH: mm: s- offset 的 UTC 时间戳, 如 < code> 2012-05- 25T11: 30: 47-07: 00 。

我试图使用发给的java工具来签名, http://docs.amazonwebservices.com/AWSMechTurk/latst/AWSMEchanicalTurkExpresser/ MakingRequests_RequestAuthAccentication article.html" rel=“nofollow”>这里, 但我无法正确格式化日期 。

我也在玩SDK的游戏 但不知道该从哪开始

最佳回答
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd T HH:mm:ssZ");
    Date date = new Date(System.currentTimeMillis());
    System.out.println(sdf.format(date)); // 2012-06-23T00:03:52-0700
问题回答
    SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));

    //Local time zone   
    SimpleDateFormat dateFormatLocal = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    //Time in GMT
    String[] datetime = dateFormatGmt.format(new Date()).split(" ");
    String date = datetime[0];
    String time = datetime[1];

    System.out.print(date+"T"+time+"Z");




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签