Hello,

When I call the changeStatus interface using the Google ads API, I need to 
pass a 'last_change_date_time' Time parameter,
Based on my understanding,
This time is actually an account time zone, so I need to convert our time 
in Shanghai to this account time zone. When I used JAVA code to convert, 
most of the time zones were fine, but some of the time zones were converted 
to deviate from your time zone. For example, in the Africa/Cairo time zone, 
the time difference between our conversion and Shanghai time difference is 
6 hours, while the time difference returned by your interface is 5 hours. 
How can we solve this problem? Thanks !

Additionally, I am attaching the converted JAVA code:

@SneakyThrows
public static String timeZoneTransferShanghai(String time, String 
nowTimeZone,String targetTimeZone) {
if(StringUtils.isBlank(time)){
return "";
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
formatter.setTimeZone(TimeZone.getTimeZone(nowTimeZone));
Date sourceDate = formatter.parse(time);
formatter.setTimeZone(TimeZone.getTimeZone(targetTimeZone));
String targetDate = formatter.format(sourceDate);
return targetDate;
}

@Test
public void timeZoneTest(){
String currentTime = DateUtils.toString(new Date()) ;
String targetTime = timeZoneTransferShanghai(currentTime,"Asia/Shanghai",
"Africa/Cairo") ;
System.out.println("Shanghai time is :"+currentTime+" ; Cairo time is: "
+targetTime);
}

result print: 
Shanghai time is :2023-06-04 10:01:13 ;  Cairo time is:  2023-06-04 04:01:13


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c44edbb2-be4b-4d59-b7ef-bd40c8a77cafn%40googlegroups.com.
  • Ho... dongfu li
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to