Is there a way to get the “real client” datetime (and timezone) in the Web Client - by “real client” I mean the actual client machine where the browser is running and not the Servoy web client instance running on the application server.
The Servoy application.getTimeStamp() when used in a web client returns the datetime of the application server and not the actual user datetime.
I’ve never done this, but I suppose that you’ll need to capture the client’s time zone and then perform a conversion. Check Servoy Developer application node to see is there is something that will help you to capture the client’s time zone.
You need the date to be evaluated on the client side (in the browser), you can do that using the Web Client Utils plugin.
You will find it on ServoyForge of course:
Put the jar in your /application_server/plugins folder.
Then do something like this:
function onAction(event) {
var js = "var d = new Date().toUTCString();";
plugins.WebClientUtils.executeClientSideJS(js, callbackMethod, ['d']);
}
function callbackMethod(d) {
var date = new Date(d);
// now do anything you want with this date.
application.output(date);
}
In 6.0 application.getTimeStamp() for WC will simulate client date/time based on server date/time and client timezone.
But if you need the “real” time of the client machine that is the way to go, yes. (Web Client Utils plugin)