List of usage examples for com.vaadin.server WebBrowser getTimezoneOffset
public int getTimezoneOffset()
From source file:com.haulmont.cuba.web.AbstractConnection.java
License:Apache License
protected TimeZone detectTimeZone() { Page page = AppUI.getCurrent().getPage(); WebBrowser webBrowser = page.getWebBrowser(); int offset = webBrowser.getTimezoneOffset() / 1000 / 60; String hours = StringUtils.leftPad(String.valueOf(offset / 60), 2, '0'); String mins = StringUtils.leftPad(String.valueOf(offset % 60), 2, '0'); char sign = offset >= 0 ? '+' : '-'; return TimeZone.getTimeZone("GMT" + sign + hours + mins); }
From source file:com.haulmont.cuba.web.security.ConnectionImpl.java
License:Apache License
protected TimeZone detectTimeZone() { WebBrowser webBrowser = getWebBrowserDetails(); int offset = webBrowser.getTimezoneOffset() / 1000 / 60; char sign = offset >= 0 ? '+' : '-'; int absOffset = Math.abs(offset); String hours = StringUtils.leftPad(String.valueOf(absOffset / 60), 2, '0'); String minutes = StringUtils.leftPad(String.valueOf(absOffset % 60), 2, '0'); return TimeZone.getTimeZone("GMT" + sign + hours + minutes); }