Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect time zone returned from getActionInfo #47

Closed
eos1d3 opened this issue Mar 31, 2016 · 2 comments
Closed

Incorrect time zone returned from getActionInfo #47

eos1d3 opened this issue Mar 31, 2016 · 2 comments
Assignees
Milestone

Comments

@eos1d3
Copy link

eos1d3 commented Mar 31, 2016

For both Image and Droplet actions, getCompletedAt should returns a string of 2014-11-14T16:32:24Z as per DigitalOcean API doc.

But I got from Java output is Thu Mar 31 12:53:19 HKT 2016. The date seems to be converted to my local time format with HKT, but the numbers are still in UTC. It needs to add +08:00 for HKT. The actual local time is Thu Mar 31 20:53:19 HKT 2016.

It seems HKT is added incorrectly. It should be UTC regardless of the local time zone.

The workaround is to replaced HKT with UTC in the date string.

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy");
Date myDate = simpleDateFormat.parse(apiClient.getActionInfo(actionID).getCompletedAt().toString().replace("HKT", "UTC"));

System.out.println("Reboot finished at: " + myDate);
System.out.println("Reboot finished at: " + apiClient.getActionInfo(actionID).getCompletedAt());

So the first line of output is correct for HKT.

Reboot finished at: Thu Mar 31 22:39:49 HKT 2016
Reboot finished at: Thu Mar 31 14:39:49 HKT 2016

PS: This affects getCompletedAt for both DropletAction and ImageAction. And I believe the same problem to getStartedAt

@jeevatkm jeevatkm modified the milestone: v2.5 Jun 6, 2016
@jeevatkm jeevatkm self-assigned this Jun 7, 2016
@jeevatkm
Copy link
Owner

jeevatkm commented Jun 7, 2016

@eos1d3 v2.5 will have fix for this issue. Thanks for your patients.

jeevatkm added a commit that referenced this issue Jun 7, 2016
@jeevatkm
Copy link
Owner

jeevatkm commented Jun 7, 2016

Done!

@jeevatkm jeevatkm closed this as completed Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants