Amazon Turk REST调用java的日期
我想打电话:Amazon Turk REST调用java的日期,java,datetime,mechanicalturk,Java,Datetime,Mechanicalturk,我想打电话: https://mechanicalturk.amazonaws.com/?Service=AWSMechanicalTurkRequester &AWSAccessKeyId=[the Requester's Access Key ID] &Version=2012-03-25 &Operation=ApproveRejectedAssignment &Signature=[signature for this request] &Time
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
我需要签名,需要UTC时间戳,格式为YYYY:dd:MMTHH:mm:ss Offset
like2012-05-25T11:30:47-07:00
我正在尝试使用java工具制作签名,但无法正确格式化日期
我也很喜欢使用SDK,但我不知道从哪里开始
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");
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