timezone

How to set the correct local time zone in git bash?

一笑奈何 提交于 2019-12-19 08:52:00
问题 I am using git-bash on a Windows system. The Windows clock shows local time, but inside git-bash everything is in GMT time: $ date Mon Mar 31 16:08:57 GMT 2014 Also setting TZ will not change things: $ TZ="Europe/Berlin" date Mon Mar 31 16:09:01 GMT 2014 Similarly all times it git log are GMT only. Is there a way to set the correct timezone in git-bash? 回答1: On Windows the TZ variable seems to work differently. To get the German timezone you have to write: TZ=GST-1GDT date If you set it to

How to convert string timezones in form (Country/city) into datetime.tzinfo

那年仲夏 提交于 2019-12-19 05:24:18
问题 Is there a built-in library or does anyone have available a function to convert a string timezone such as "America/New_York" to a datetime.tzinfo object? Thanks. 回答1: Yes, you need the pytz library: import datetime, pytz zoneName = 'America/New_York' now = datetime.datetime.now(pytz.timezone(zoneName)) returns: datetime.datetime(2011, 3, 16, 1, 39, 33, 87375, tzinfo=<DstTzInfo 'America/New_York' EDT-1 day, 20:00:00 DST>) 来源: https://stackoverflow.com/questions/5321466/how-to-convert-string

how to get client's time zone in java from HttpServletRequest? [duplicate]

孤街浪徒 提交于 2019-12-19 05:12:40
问题 This question already has answers here : How to detect the timezone of a client? (4 answers) Closed last year . When server and client are in different time zones, can i get client's time zone in java using HttpServletRequest? I am trying to create an instance of 'Calender' using client's 'Locale' like this, Calendar calendar = Calendar.getInstance(request.getLocale()); TimeZone clientTimeZone = calendar.getTimeZone(); But this is giving me Server's time zone only. Is this method wrong? Is

In PHP, how can I get Timezone from offset and country?

╄→尐↘猪︶ㄣ 提交于 2019-12-19 04:18:11
问题 I am doing an IP lookup to determine a "best guess" for timezone offset from UTC and the country/region information. So, for instance, I have offset -3 and country Brazil. I want to show BRT instead of a random timezone in that same offset, i.e. ART Is there some built-in way in PHP to be able to set the appropriate timezone with this information? If not, what would be the easiest way to do this? (Assume that I can't make any outside API calls) If I do my own database table, how do I ensure

Set custom timezone in Django/PostgreSQL (Indian Standard Time)

感情迁移 提交于 2019-12-19 03:59:09
问题 In Django documentation for setting timezone, the list of available choices for timezone are actually postgres timezone parameter strings. So it seems Django uses Postgres for retrieving time. If so, then the problem is that IST is used to denote both Indian & Israel Standard Time, but postgres uses IST for Israel Standard Time (potentially confusing over a 6th of world's population) and there is NO timezone string for Indian Standard Time. Not just that, Postgres also misses timezone for

TimeZone with Calendar confusing results

非 Y 不嫁゛ 提交于 2019-12-19 03:37:25
问题 I have been working with timezone conversions lately and am quite astonished by the result i get.Basically, i want to convert a date from one timezone into another. below is the code, conversions working fine, but what i have observed while debugging is, the date is not converted unless i call Calendar#get(Calendar.FIELD) . private static void convertTimeZone(String date, String time, TimeZone fromTimezone, TimeZone toTimeZone){ Calendar cal = Calendar.getInstance(fromTimezone); String[]

How to change MySQL Server time zone?

主宰稳场 提交于 2019-12-19 03:26:13
问题 I am administrating a MySQL Server. It is installed on a ubuntu server. Recently I discovered, that the ubuntu server was set on a false timezone. I corrected that through terminal by the command dpkg-reconfigure tzdate . Now I want the MySQL Server to adapt this setting. Is this possible? 回答1: In your /etc/mysql/mysql.conf or wherever it is, check out the default-time-zone 回答2: You need to update mysql tables on server for supporting the timezones names. Use shell command on server: mysql

convert to local time zone using latitude and longitude?

陌路散爱 提交于 2019-12-19 03:13:21
问题 I have a data set with the following information: latitude, longitude, EST time. For example, for one observation lat = 13 long = -2 time1 = as.POSIXlt("2014-02-12 17:00:00", tz = "EST") I want to create a new variable timeL that is the local time. Any suggestions of how to do this with R? Thanks! 回答1: lat = 13 long = -2 time1 <- as.POSIXct("2014-02-12 17:00:00", tz = "EST") # https://developers.google.com/maps/documentation/timezone/ apiurl <- sprintf("https://maps.googleapis.com/maps/api

problems with Java daylight savings time

ぐ巨炮叔叔 提交于 2019-12-19 01:46:42
问题 I have a Java app that needs to be cognizant of the time zone. When I take a Unix epoch time and try to convert it into a timestamp to use for an Oracle SQL call, it is getting the correct timezone, but the timezone "useDaylightTime" value is not correct, i.e., it is currently returning "true", when we are NOT in DST (I am in Florida in TZ "America/New_York"). This is running on Red Hat Linux Enterprise 6, and as far as I can tell, it is correctly set up for the timezone, e.g. 'date' returns:

convert date and time in any timezone to UTC zone

落花浮王杯 提交于 2019-12-19 01:20:34
问题 this is my date " 15-05-2014 00:00:00 " how to convert IST to UTC i.e( to 14-05-2014 18:30:00) based on from timezone to UTC timezone. my code is DateFormat formatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("IST")); //here set timezone System.out.println(formatter.format(date)); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); //static UTC timezone System.out.println(formatter.format(date)); String str = formatter.format(date); Date date1