Web View Incorrect Time zone

Hello ,

Recently, I made a Webview app. There is one major issue with it and I’m not getting how to solve it. The app is for Australia (developed in India). The website fetched in webview fetches local time to decide order / delivery status. But the webview is fetching India’s time and hence the website is not functioning properly.

Here’s my code

scene = composer.newScene() function scene:create( event ) local sceneGroup = self.view local PLAY = display.newGroup() sceneGroup:insert(PLAY) local webView = native.newWebView( 0, 0, \_W, \_H) webView:request( "My website URL" ) -- URL for website was inserted here local redRoosterImg = display.newImageRect( PLAY,"load.png",\_W,\_H ) redRoosterImg.x=0; redRoosterImg.y=0; function redRoosterLoad() display.remove( redRoosterImg ) end end function scene:show( event ) timerPlay = timer.performWithDelay(3000,redRoosterLoad,1) end function scene:destroy( event ) local sceneGroup = self.view sceneGroup:remove(PLAY) end scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene

Someone please suggest a solution to it.

I don’t see anything in your code to do with a timezone. If I had to guess, I’d say that the server that hosts the website is in India, and is returning it’s local time.  

You could perhaps try getting the timezone in your Lua code, and then either send that to the server or using it in the app to calculate the difference between the time in India and the time where the user is.

Here is a forum post where other people were working with time zones:

https://forums.coronalabs.com/topic/37294-time-zones-question/

Thank you for the advice but I have a point too. If the server fetches time from India why is the website working properly … ?? I guess there is a different issue here

Based on the code you’ve posted it’s difficult to even guess I’m afraid.  

Perhaps when viewing the website in a browser, the browser automatically sends some timezone data, but the Corona webview does not do this and so uses the default server timezone? The code that handles that would be on the server rather than in the app.

I don’t see anything in your code to do with a timezone. If I had to guess, I’d say that the server that hosts the website is in India, and is returning it’s local time.  

You could perhaps try getting the timezone in your Lua code, and then either send that to the server or using it in the app to calculate the difference between the time in India and the time where the user is.

Here is a forum post where other people were working with time zones:

https://forums.coronalabs.com/topic/37294-time-zones-question/

Thank you for the advice but I have a point too. If the server fetches time from India why is the website working properly … ?? I guess there is a different issue here

Based on the code you’ve posted it’s difficult to even guess I’m afraid.  

Perhaps when viewing the website in a browser, the browser automatically sends some timezone data, but the Corona webview does not do this and so uses the default server timezone? The code that handles that would be on the server rather than in the app.