summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-03-25 23:53:48 +0200
committerVaadin Code Review <review@vaadin.com>2013-04-03 11:01:59 +0000
commitd94f2cc6c3a1af73077ff902856da03c41a6e824 (patch)
tree792be7aacdc84e898daedfa86682a0ab6556a01c /server
parent29013c34b6407bc0b5c65d52ee760f533105c052 (diff)
downloadvaadin-framework-d94f2cc6c3a1af73077ff902856da03c41a6e824.tar.gz
vaadin-framework-d94f2cc6c3a1af73077ff902856da03c41a6e824.zip
Added example on how to get time displayed in the browser (#9033)
Change-Id: I349120b3e1ead2428009b7a0d77ec30a775eb34a
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/WebBrowser.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/com/vaadin/server/WebBrowser.java b/server/src/com/vaadin/server/WebBrowser.java
index 28b92e28b8..8038bbc207 100644
--- a/server/src/com/vaadin/server/WebBrowser.java
+++ b/server/src/com/vaadin/server/WebBrowser.java
@@ -319,6 +319,17 @@ public class WebBrowser implements Serializable {
* entirely accurate due to varying network latencies, but should provide a
* close-enough value for most cases. Also note that the returned Date
* object uses servers default time zone, not the clients.
+ * <p>
+ * To get the actual date and time shown in the end users computer, you can
+ * do something like:
+ *
+ * <pre>
+ * WebBrowser browser = ...;
+ * SimpleTimeZone timeZone = new SimpleTimeZone(browser.getTimezoneOffset(), "Fake client time zone");
+ * DateFormat format = DateFormat.getDateTimeInstance();
+ * format.setTimeZone(timeZone);
+ * myLabel.setValue(format.format(browser.getCurrentDate()));
+ * </pre>
*
* @return the current date and time of the browser.
* @see #isDSTInEffect()