Hi there,

Thanks for reaching out to the Google Ads API Forum.

Yes, Google Ads API pulls the account timezone. You may see if below sample 
code which will first get the current time in the Asia/Shanghai timezone using 
the SimpleDateFormat class. Then, it will set the timezone of the 
SimpleDateFormat object to the Africa/Cairo timezone. Finally, it will parse 
the time in the Asia/Shanghai timezone to get the time in the Africa/Cairo 
timezone.

@SneakyThrows

public static String timeZoneTransferShanghai(String time, String 
nowTimeZone,String targetTimeZone) {

        if(StringUtils.isBlank(time)){

        return "";

         }

        TimeZone shanghaiTimeZone = TimeZone.getTimeZone("Asia/Shanghai");

        TimeZone cairoTimeZone = TimeZone.getTimeZone("Africa/Cairo");



        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        sdf.setTimeZone(shanghaiTimeZone);



        Date shanghaiTime = new Date();

        String shanghaiTimeStr = sdf.format(shanghaiTime);



        sdf.setTimeZone(cairoTimeZone);



        Date cairoTime = sdf.parse(shanghaiTimeStr);

        String cairoTimeStr = sdf.format(cairoTime);



        System.out.println("The time in Asia/Shanghai is " + shanghaiTimeStr);

        System.out.println("The time in Africa/Cairo is " + cairoTimeStr);

        return cairoTimeStr;

}


You may note that Google Ads API pulls the data shown on Ads UI, and converting 
from one timezone to another is a custom implementations. If you need further 
assistance, then you may seek through other public forums like Stackoverflow.

This message is in relation to case "ref:_00D1U1174p._5004Q2m9BqZ:ref"

Thanks,

Google Ads API Team

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/Z67AW000000000000000000000000000000000000000000000RVWJQ100LPb868rxRoWorKdVHS8RDg%40sfdc.net.
  • Ho... dongfu li
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to