Hey how to get the time of the computer and not the server using vaadin because getDate return to me the time of the server but i want the client computer time ??
Vaadin has a class called WebBrowser that provides useful information about the client (browser):
You can access the current WebBrowser instance for example as follows:
public class MyApplication extends Application {
@Override
public void init() {
setMainWindow(new Window());
ApplicationContext context = this.getContext();
if (context instanceof WebApplicationContext) {
WebBrowser webBrowser = ((WebApplicationContext) this.getContext()).getBrowser();
Date now = webBrowser.getCurrentDate(); // Returns the current date and time on the browser
}
}
}
For more information about the WebBrowser class, see its JavaDocs.