timezone

How to assign Date parameters to Hibernate query for current timezone?

一世执手 提交于 2020-01-11 15:26:09
问题 When you assign a date to a named SQL parameter Hibernate automatically converts it to GMT time. How do you make it use the current server timezone for all dates? Lets say you have a query: Query q = session.createQuery("from Table where date_field < :now"); q.setDate("now", new java.util.Date()); "now" will be set to GMT time, while "new Date()" gets your current server time. Thanks. 回答1: As it turned out Hibernate doesn't convert dates to GMT automatically, it just cuts off time if you use

How to manage timezone for different users of different countries for a php web application?

只愿长相守 提交于 2020-01-11 11:36:09
问题 I am developing web application. The application has different users from different countries. I have used to manage thier registrations using UTC timestamp. It works fine for me. But problem occures when I am checking the expiry date of account. For example - Suppose registration will be valid for 15 days and user from India whose registration date is 11 June 2014 as per Asia/Kolkata timezone, in the database table I have stored the registration date in Unix Timestamp format (Server set to

ConvertTimeFromUTC, Handling Australia DST

旧巷老猫 提交于 2020-01-11 11:22:09
问题 I have the following code, and I have a a customer in Canberra, Australia. They are typically UTC+10, however they are in DST right now so it is UTC+11. What is odd is when I run this code it is not accounting for DST, which I thought ConvertTimeFromUTC handles. I am passing E. Australia Standard Time as the "timeZone" parameter. Any thoughts? var myTimeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZone); var currentDateTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, myTimeZone);

Dates are adjusted for users only at midnight on my xpages

落花浮王杯 提交于 2020-01-11 10:32:33
问题 We have a really strange problem in xpages regarding dates, the Notesdocument we have contain a date field and the value is only a date, there is no time portion. In the xpage I have specified to display the date as a date/time value. the date display correctly on the webpage but we are now getting reports from users who login at night (around midnight) and see the date as adjusted by one day. if the same people login at daytime the date is correct so this only seem to happend around midnight

PHPExcel gets wrong timezone even after setting date_default_timezone_set

戏子无情 提交于 2020-01-11 06:31:48
问题 I'm using http://phpexcel.codeplex.com in one of my project, and I have come into an issue. I want to write the time() value inside a cell, which I am doing with : function writeTimeLine($objActiveSheet, &$lineNumber, $timeStart, $timeEnd, $duration, $category, $client, $date, $comment) { $objActiveSheet->setCellValue('A'.$lineNumber, PHPExcel_Shared_Date::PHPToExcel( $timeStart )); $objActiveSheet->getStyle('A'.$lineNumber)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat:

How to properly parse timezone codes

旧巷老猫 提交于 2020-01-11 05:38:08
问题 In the example bellow the result is always "[date] 05:00:00 +0000 UTC" regardless the timezone you choose for the parseAndPrint function. What is wrong with this code? The time should change depending on the timezone you choose. (Go Playground servers are apparently configured in UTC timezone). http://play.golang.org/p/wP207BWYEd package main import ( "fmt" "time" ) func main() { now := time.Now() parseAndPrint(now, "BRT") parseAndPrint(now, "EDT") parseAndPrint(now, "UTC") } func

Javascript World Timezone Difference to GMT Calculator

喜你入骨 提交于 2020-01-11 03:54:46
问题 I was hoping someone could send me in the direction of a regularily updating time zone database. I have found one, but apologies i cant remember where it was from, however with the current GMT clock change fast approaching, i fear all my data will be incorrect, ie the differences from UK to New Yrok will change from 5 hours behind to 6 hours behind. Any help on this matter would be much appreciated. Cameron 回答1: Do you mean like the Olson database ? For instance, the fleegix.js javascript

How to save dates in local timezone to db with rails3?

做~自己de王妃 提交于 2020-01-10 10:42:30
问题 I have Rails3 application with model user and field expires_at created like this: t.column :expires_at, :timestamp In my database (postgresql) it has type: timestamp without timezone The problem is when I call: @user.expires_at = Time.now @user.save it is saved into database with UTC timezone (my local time is UTC + 1:00, Warsaw) but I don't want that. I just want to have time with my local timezone saved into the database (2011-03-30 01:29:01.766709, not 2011-03-29 23:29:01.766709) Can I

How to save dates in local timezone to db with rails3?

烂漫一生 提交于 2020-01-10 10:42:27
问题 I have Rails3 application with model user and field expires_at created like this: t.column :expires_at, :timestamp In my database (postgresql) it has type: timestamp without timezone The problem is when I call: @user.expires_at = Time.now @user.save it is saved into database with UTC timezone (my local time is UTC + 1:00, Warsaw) but I don't want that. I just want to have time with my local timezone saved into the database (2011-03-30 01:29:01.766709, not 2011-03-29 23:29:01.766709) Can I

In Rails, how get current time zone (Time.zone) in a format that can be used with ActiveSupport::TimeZone[zone].parse()?

本秂侑毒 提交于 2020-01-09 19:39:07
问题 How can a method take the current Time.zone and put it into a format that is usable by ActiveSupport::TimeZone[some_zone].parse() ? It seems very strange that Time.zone.to_s returns a string that can not be used with ActiveSupport::TimeZone[zone].parse() Time.zone.to_s returns "(GMT-08:00) Pacific Time (US & Canada)" But ActiveSupport::TimeZone["(GMT-08:00) Pacific Time (US & Canada)"] is nil . ActiveSupport::TimeZone["(GMT-08:00) Pacific Time (US & Canada)"] => nil ActiveSupport::TimeZone[