timezone

Using Joda time to get current wall time for a given Time Zone

China☆狼群 提交于 2019-12-31 10:39:33
问题 The requirement is to simply to get the current wall time ( including the correct DST adjustment ) for a given Time Zone. There seems to be a few questions in SO hovering around this, but I can't seem to find a straight answer (in SO, Joda doco or googling) with a low friction way of getting the wall time. It seems like with the given inputs (current UTC time and desired TZ) I should be able to chain a couple methods from the Joda Time library to achieve what I want but there seems to be a

Gson: java.text.ParseException: Unparseable date: “2018-04-09T09:00:00+02:00”

China☆狼群 提交于 2019-12-31 05:22:07
问题 How can I parse a string date in the format: "2018-04-09T09:00:00+02:00" Gson uses: new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US) But it gives the following exception: com.google.gson.JsonSyntaxException: 2018-04-09T09:00:00+02:00 at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:107) at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:82) at com.google.gson.DefaultDateTypeAdapter.deserialize

How to handle MySQL timezone in script

不问归期 提交于 2019-12-31 03:45:29
问题 I am developing a mobile application. From the application calls are made to a web service which runs different queries based on mode (?mode=xx) In some of those queries I use date functions like DATE(NOW()). The data stored in the MySQL database is stored in GMT-7 (Mountain Time Canada). I have yet to register a domain/host for this web service but when I do lets say it is hosted in a different city such as Toronto (which is GMT-5 - 2 hours ahead). Then at 10:05pm Mountain Time Canada a user

PHP: How to get timezone value (ex: Eastern Standard Time) from timezone name (ex: America/New_York)?

故事扮演 提交于 2019-12-31 03:43:09
问题 Is there a PHP function anywhere which converts between the timezone name (such as those found here: http://php.net/manual/en/timezones.america.php) and the "value" such as Eastern Standard Time, or Pacific Daylight Time? Not looking to convert between zones, just get the EST, PDT, etc. names given the America/New_York (or other) name. The only similar question I found is for a different language. 回答1: If you you install the PHP Internationalization Package, you can do the following:

How to get server timezone in javascript

南笙酒味 提交于 2019-12-31 02:44:09
问题 I want to set different timezone in Javascript.Currently It is showing date and time zone of local machine or client's PC date /timezone. Regards, 回答1: Javascript is a client-side language and does not interact with the server that way. You'll need to fetch that data from your server-side platform. Here is some PHP code to get the data you are looking for. You'll either need to put this in your page and echo the result into a JS variable.... <?php $date = new DateTime(null, new DateTimeZone(

Blackberry date time string formatting

こ雲淡風輕ζ 提交于 2019-12-30 11:47:46
问题 I need to parse the date/time string, to add the raw offset and convert it according to local time zone. The date time that I get from server is in this format : "05-25-2012 02:30 PM" This format is not parsed by : HttpDateParser.parse(time) method But HttpDateParser does parse this format : "25-MAY-2012 02:30 PM" Can you tell me, how should I parse "05-25-2012 02:30 PM" String in BB to get a long value. I have 1 more problem, I need to display time zone in format GMT, IST, but all I can

PHP adjust time zone for date

三世轮回 提交于 2019-12-30 10:33:11
问题 Quick question, The following output on my website is -1 hr, and I just wanted a quick fix to adjust it accordingly, but I'm not sure of the correct syntax... <?php echo date('D, jS F @ g:ia', strtotime($row->datetime)); ?> Any advice? 回答1: Use the date_default_timezone_set function of PHP to set the your timezone as default it is taking the timezone of server. Here is the list of timezones. 回答2: set default time zone $timezone = 'America/Los_Angeles'; $stored_time = '2011-01-30 18:23:49';

PHP adjust time zone for date

不问归期 提交于 2019-12-30 10:32:37
问题 Quick question, The following output on my website is -1 hr, and I just wanted a quick fix to adjust it accordingly, but I'm not sure of the correct syntax... <?php echo date('D, jS F @ g:ia', strtotime($row->datetime)); ?> Any advice? 回答1: Use the date_default_timezone_set function of PHP to set the your timezone as default it is taking the timezone of server. Here is the list of timezones. 回答2: set default time zone $timezone = 'America/Los_Angeles'; $stored_time = '2011-01-30 18:23:49';

Australia DST timezone abbreviation incorrect when using date_default_timezone_set

淺唱寂寞╮ 提交于 2019-12-30 10:26:55
问题 I'm trying to represent a UTC timestamp in different timezones using PHP's date_default_timezone_set function. Daylight saving has just kicked in here (NZ) and in Australia, and I'm getting mixed results... Here's some test code... date_default_timezone_set('NZ'); print '<p>NZ time is ' . date('Y-m-d H:i:s T (I)') . '</p>'; date_default_timezone_set('Australia/NSW'); print '<p>NSW time is ' . date('Y-m-d H:i:s T (I)') . '</p>'; date_default_timezone_set('Australia/North'); print '<p>NT time

Parsing date with different time zones

戏子无情 提交于 2019-12-30 10:11:29
问题 Even with about 15 years in Java one always stumbles over the topic of handling dates and times... Here's the situation: I get a timestamp from some external system as a String representation. The timestamp's semantic is that it represents an UTC date. This timestamp has to be put in an entity and then into a PostgreSQL database in a TIMESTAMP field. Additionally I need to put the same timestamp as local time (in my case CEST) into the entity and then into the database in a TIMESTAMP WITH