Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I find the timezone offset in hours from the UTC with latitude and longitude
    text
    copied!<p>I'm using the <a href="http://solitudo.net/software/lua/weatherlib/" rel="nofollow">weatherlib</a> library in my code to find the sunrise and sunset time, but I can't find the user's current timezone for a latitude and longitude <strong>offline</strong>. Here's some extra information on the topic:</p> <p>Reference for<code>calc_sunrise</code>:</p> <pre> calc_sunrise (date, latitude, longitude, timezone) Calculate the time of sunrise at the given date and location. Routines from the JavaScript code at http://www.esrl.noaa.gov/gmd/grad/solcalc/. Parameters - date: an os.date table representing the date for which to calculate the time of sunrise - latitude: Latitude of the location - longitude: Longitude of the location - timezone: Timezone as an offset in hours from UTC at the given location Return value: - os.date table that holds the date and time when sunrise occurs </pre> <p>They also have a <code>calc_timezone_offset</code> function, but you need the string for the current timezone. Here's the reference for it: </p> <pre> calc_timezone_offset (timezone) Calculate timezone offset from UTC in seconds for the given timezone. Uses external command date(1). Takes Daylight Saving Time into account if the local date command supports that. Tested only on Ubuntu Linux 10.04 and Solaris 10 operating systems. May not be very portable. Parameters - timezone: Timezone name, e.g. Europe/Helsinki, Asia/Bangkok, US/Pacific Usage - weatherlib.calc_timezone_offset('Europe/Helsinki') -- 7200 - weatherlib.calc_timezone_offset('Asia/Bangkok') -- 28800 - weatherlib.calc_timezone_offset('US/Pacific') -- -28800 Return value: - Timezone offset in seconds from UTC. Positive for timezones ahead of UTC, negative for timezones behind UTC. </pre> <p>Thank you!<br> P.S. I did look for duplicate questions, but none gave me a answer for offline usage. </p> <p>Edit: Specified I need this to be offline.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload