timezone

get client time zone from browser

给你一囗甜甜゛ 提交于 2019-12-17 00:30:50
问题 Is there a reliable way to get a timezone from client browser? I saw the following links but I want a more robust solution. Auto detect a time zone with JavaScript Timezone detection in JavaScript 回答1: Look at this repository pageloom it is helpful download jstz.min.js and add a function to your html page <script language="javascript"> function getTimezoneName() { timezone = jstz.determine() return timezone.name(); } </script> and call this function from your display tag 回答2: Half a decade

How to handle calendar TimeZones using Java?

坚强是说给别人听的谎言 提交于 2019-12-16 20:12:47
问题 I have a Timestamp value that comes from my application. The user can be in any given local TimeZone. Since this date is used for a WebService that assumes the time given is always in GMT, I have a need to convert the user's parameter from say (EST) to (GMT). Here's the kicker: The user is oblivious to his TZ. He enters the creation date that he wants to send to the WS, so what I need is: User enters: 5/1/2008 6:12 PM (EST) The parameter to the WS needs to be : 5/1/2008 6:12 PM (GMT) I know

“date(): It is not safe to rely on the system's timezone settings…”

扶醉桌前 提交于 2019-12-16 19:54:11
问题 I got this error when I requested to update the PHP version from 5.2.17 to PHP 5.3.21 on the server. <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"> <h4>A PHP Error was encountered</h4> <p>Severity: Warning</p> <p>Message: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you

Wrong Time When Importing ICS Event

北慕城南 提交于 2019-12-14 04:09:03
问题 I have a .ics file that has the following iCalendar code: BEGIN:VCALENDAR PRODID;X-RICAL-TZSOURCE=TZINFO:-//Company Name//NONSGML example.co m//EN CALSCALE:GREGORIAN VERSION:2.0 METHOD:PUBLISH BEGIN:VTIMEZONE TZID;X-RICAL-TZSOURCE=TZINFO:America/Los_Angeles BEGIN:DAYLIGHT DTSTART:20180311T020000 RDATE:20180311T020000 TZOFFSETFROM:-0800 TZOFFSETTO:-0700 TZNAME:PDT END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT CREATED;VALUE=DATE-TIME:20180622T002920Z DTEND;TZID=America/Los_Angeles;VALUE=DATE-TIME

RoR Postgresql timezone group by not working on Heroku

我的未来我决定 提交于 2019-12-14 03:47:00
问题 I would like my reports to display in CST while my database is in UTC. For this to work I need to be able to group by a time column and have the db do timezone conversions. This works on my dev postgresql box: offset = -5 result = ActiveRecord::Base.connection.execute("select date(srl.created_at AT TIME ZONE '#{offset.to_s}') AS date, count(*) from server_request_logs srl where srl.created_at between '#{@from.to_s(:db)}' and '#{@to.to_s(:db)}' group by date(srl.created_at AT TIME ZONE '#

Getting the Canonical Time Zone name in shell script

一世执手 提交于 2019-12-14 03:43:33
问题 Is there a way of getting the Canonical Time Zone name from a Linux shell script? for example, if my configured time zone is PDT, then I would like to get "America/Los_Angeles". I know I could get from the symbolic link /etc/localtime if it were configured, but as it might not be configured in all servers I cannot rely on that one. On the other hand, I can get the short time zone name with the command date +%Z, but I still need the canonical name. Is there a way to either get the canonical

How to set Z as timezone in SimpleDateFormat

泪湿孤枕 提交于 2019-12-14 03:35:29
问题 Code sample: SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); System.out.println(dateFormat.getTimeZone()); System.out.println(dateFormat.parse(time)); // dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Kolkata")); I don't want to use the commented section. Zone should be set based on IST that I am giving in the input string: String time ="2018-04-06 16:13:00 IST"; Current machine zone is: America/New_York . How should I get zone changes to IST based on z?

Calculating timezone from GMT value - Android

一个人想着一个人 提交于 2019-12-14 03:27:28
问题 In a android form , i am accepting a GMT value(offset) from user such a +5:30 , +3:00. and from this value , i want to calculate the timeZone that is "India/Delhi". Any ideas on how to do it ......Plzz 回答1: If you already have a specific instant in time at which that offset is valid, you could do something like this: import java.util.*; public class Test { public static void main(String [] args) throws Exception { // Five and a half hours int offsetMilliseconds = (5 * 60 + 30) * 60 * 1000;

Changing time zone with Calendar object from EEST to HST changes the time-of-day unexpectedly

无人久伴 提交于 2019-12-14 03:25:02
问题 I have some TimeStamp and I have date format "EEEE, MMM dd, yyyy hh:mm a zzz" . But I don't know how I can show this timestamp with timezone. When I trying to show it I get wrong DateTime or wrong timezone example1: Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date(device.getUpdatedDate().getTime())); // here is 2018-07-09 20:02:26.506000 SimpleDateFormat sdf = new SimpleDateFormat(EMAIL_DATE_FORMAT); sdf.format(calendar.getTime()); // i have wrong timezone and i get

Timer, timezone, server side time, client side countdown

空扰寡人 提交于 2019-12-14 03:17:25
问题 I've launch a project recently (here), and I'm stuck with a timer/time question : I have a cronjob who runs everyday, twice a day : midnight and midday in french timezone. I want to display a "countdown till next page", which is in fact a countdown till cronjob. I'm a bit stuck, because when I start to think time and timezone related things, my brain just freeze. I know I should take server side time, and display my variables in a client side timer (without getting the client side time), but