timezone

What is wrong with java zoneinfo?

拈花ヽ惹草 提交于 2019-12-14 01:51:55
问题 I have a Europe/Moscow timezone in my Mageia 4. The code like this System.out.println(new java.util.Date()); System.out.println(System.getProperty("user.timezone")); returns Fri Oct 24 13:43:22 GMT+03:00 2014 GMT+03:00 if I set the system date in 24.10.2014 and that code returns Sun Oct 26 14:44:26 GMT+03:00 2014 GMT+03:00 if I set the system date in 26.10.2014 In my point of view it is wrong behavior of java zoneinfo system. I downloaded the tzupdater and run it, the file Europe/Moscow was

DateTime formatting and timezone

眉间皱痕 提交于 2019-12-14 01:13:44
问题 When trying to parse a Date with DateTime::createFromFormat PHP will not recognize the timezone. Example: $t = new \DateTime(); echo $t->format('Y-m-dTH:i:s'); will output 2012-01-24MSK16:53:52 Now when I try to parse that string from the same format var_dump(\DateTime::createFromFormat('Y-m-dTH:i:s', '2012-01-24MSK16:53:52')); I get bool(false) When I do not put the Timezone into the string, it works $t = new \DateTime(); echo $t->format('Y-m-dH:i:s'); will give 2012-01-2417:17:24 and

Daylight saving time in java

和自甴很熟 提交于 2019-12-14 00:32:17
问题 please see if you can tell me how to handle the DST issue in my case. first, my application is a logistic system and it is for global user,so it involves timezone problem,i will handle it as following when set user local date of booking: 1.when user login application,we could get user's timezone according to login IP,but is is just an offset (i don't remember the term of this stuff) e.g "GMT+08"(BeiJing) or "GMT-06"(Chicago) . 2.before user save booking ,we need to set booking local date,as i

Inserting date / time in a specific zone into MySQL database

半腔热情 提交于 2019-12-13 23:58:47
问题 I found no way to insert date/time into MySQL database in a standard zone like UTC. The following segment of code authenticates a user by using Apache DBCP. public final class AuthenticationDAO { public boolean isAuthenticated(String userName, String password) throws SQLException { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; boolean status = false; try { connection = DatabaseConnection.getConnection(); preparedStatement = connection

Programmatically get the time at clock-change [closed]

旧时模样 提交于 2019-12-13 23:04:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . i am confused about timezone and countrys at time-changes. Carlifornia changes the time at 10am, NewYork at 7am. How can i programmatically get informations when the time will change next in California? 回答1: To find out DST transitions, you could access Olson timezone database e.g., to find out the time of the

Rails configure Timezone from YML file

血红的双手。 提交于 2019-12-13 22:46:01
问题 I have a Rails 3.2.x app with my default timezone set in application.rb as config.time_zone = 'Central Time (US & Canada)' I will be spinning up new servers in other timezones and need to figure out how to read the timezone configuration from a company.yml file where I set certain company attributes while still using the same github repo for ease of management. For each server I have the following file in config/initializers/company.rb default_company = { company_name: "changeme", company

In ASP.NET MVC2, convert time user's timezone. How to get timezone info? [closed]

南楼画角 提交于 2019-12-13 22:31:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I stored datetime into database then i retrieve the values.. My server db is located other country. so when the value is retrieve it is taking other country date and time.. I tried in controller as follow, if (item.CreatedDate == null) { item.CreatedDate = DateTime.Now; var timeZone = TimeZoneInfo

ActiveSupport::TimeZone not recognized in Rspec tests

谁都会走 提交于 2019-12-13 21:38:36
问题 I am using ActiveSupport::TimeZone to set the time zone on a location based on the zip code. def set_time_zone self.time_zone = ActiveSupport::TimeZone.find_by_zipcode(self.zip) end This works just fine in the application itself. I am calling the set_time_zone on before_save. In running the tests with Rspec, when it tries to run the set_time_zone method it errors out with "undefined method 'find_by_zipcode'in ActiveSupport::TimeZone" I have included "require 'active_support/time_with_zone'"

convert date based on timezone user is in

牧云@^-^@ 提交于 2019-12-13 20:36:53
问题 I have a date I want to convert based on their timezone. For example, I want to set it in EST time (America/New_York) 2019-04-24 12:00:00 and if the user comes across the site from America/Los_Angeles, it will appear: 2019-04-24 09:00:00 I need to be able to return the hour, so in that example: 9. I tried using https://github.com/iansinnott/jstz to determine their timezone and https://moment.github.io/luxon in hopes of handling the conversion w/o any luck. I was testing by changing the

Javascript Date issue, incorrect timezone

我怕爱的太早我们不能终老 提交于 2019-12-13 18:46:28
问题 I got this strange JavaScript bug that I can seem to work arround or fix. I am using some code to make 2 JavaScript dates, to insert events into a calendar component. The dates are built the following way: var endDate = new Date(); var startDate = new Date(); startDate.setDate(startDateDay); startDate.setMonth(startDateMonth); startDate.setFullYear(startDateYear); startDate.setHours(2, 0, 0, 0); endDate.setDate(endDateDay); endDate.setMonth(endDateMonth); endDate.setFullYear(endDateYear);