Dear all,

we have the problem that the timestamp for storing in the database is the local timestamp where the database server is hosted. We need also the local time of the user request, sided all around the word.

To calculate the local time of the user there is a https-api-call via Google Maps and the answer will deliver the time zone with the off_set und the daylight saving time offset as diffenrce to UTC.

For example: Today it is 2016-06-13 09:45 CEST = 07:45 UTC; the API delivers for Sydney: 36000 Seconds offset and 0 Secondes dst-offset and for Berlin 3600 Seconds offset and 3600 Seconds dst-offset; I can now calculate Berlin Time - 1 Hour Offset - 1 Hour DST-Offset = UTC + 10 Hours = Sidney Local Time = 17:45

https://maps.googleapis.com/maps/api/timezone/xml?location=-33.510000,151.200000&timestamp=1696060417

Is is possible to do this with IVY or is thera an other way to get the local time of the staff's office?

Thanks in advance.

Best regards Dieter

asked 13.06.2016 at 13:52

Dieter%20Staudt's gravatar image

Dieter Staudt
(suspended)
accept rate: 50%

1

How do you now the staff's location? You may can use user properties to store the users time zone difference.

(14.06.2016 at 17:42) Reto Weiss ♦♦ Reto%20Weiss's gravatar image
1

To call the API use JAX-RS. The library is integrated with newer Axon.ivy Versions (6.1). With older versions simply add the necessary libraries to your project. With Axon.ivy Version 6.2 they will be support for REST clients as the one above.

(14.06.2016 at 17:43) Reto Weiss ♦♦ Reto%20Weiss's gravatar image

In the meantime I found some java coding:

String url = "https://maps.googleapis.com/maps/api/timezone/xml?location=-33.510000,151.200000&timestamp=1696060417"
String res = "";
int readtimeout = 10000;

try {
    java.net.URL jUrl = new java.net.URL(url);
    java.net.URLConnection jCon = jUrl.openConnection();
    jCon.setReadTimeout(readtimeout);
    java.io.InputStream ins = jCon.getInputStream();

    if (in.maxRespSize > 0)
    {
        int cnt = 0;
        int b = ins.read();
        while (b > -1 && cnt < in.maxRespSize)
        {
            res += Character.toChars(b).get(0).toString();
            b = ins.read();
            cnt++;
        }
    }
}

catch (java.net.MalformedURLException e) {
    in.e.e = e.getMessage() + "#ReadTimeout="+readtimeout;
    in.e.Remark = e.stackTrace.toString();
    ivy.log.error("URLOpenStream ("+e.getClass().getName()+"):" + in.e.e + ":" + url);
}
catch (java.io.IOException e) {
    in.e.e = e.getMessage() + "#ReadTimeout="+readtimeout;
    in.e.Remark = e.stackTrace.toString();
    ivy.log.error("URLOpenStream ("+e.getClass().getName()+"):" + in.e.e + ":" + url);
    }
catch (Exception e) {
    in.e.e = e.getMessage() + "#ReadTimeout="+readtimeout;
    in.e.Remark = e.stackTrace.toString();
    ivy.log.error("URLOpenStream ("+e.getClass().getName()+"):" + in.e.e + ":" + url);
    }

But HTTP-Error 407 will happen - I don't understand this, because the following parameters are in the ...\AxonIvyEngineA51\jre\lib\net.propierties-file: http.proxyHost=xxxxxx.yyyyyy-zzzzzz.loc http.proxyPort=8080 http.nonProxyHosts=localhost|127.|[::1] http.nonProxyHosts=ivy3|ivy3.thiel-logistik.loc|localhost|127.|[::1]

Who can help me?

Thank you

link

answered 27.06.2016 at 11:56

Dieter%20Staudt's gravatar image

Dieter Staudt
(suspended)
accept rate: 50%

edited 27.06.2016 at 13:47

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×48
×11

Asked: 13.06.2016 at 13:52

Seen: 3,093 times

Last updated: 27.06.2016 at 13:47