timestamp-with-timezone

google map Time Zone get local time

会有一股神秘感。 提交于 2019-12-06 02:21:54
I'm trying to use google Time Zone API. I provide the longitude and latitude and the API give me the timezone. How can I get the local time with this following value (dstOffset and rawOffset) ? Here is the Json { "dstOffset" : 0.0, "rawOffset" : -28800.0, "status" : "OK", "timeZoneId" : "America/Los_Angeles", "timeZoneName" : "Pacific Standard Time" } I have tried this javascript function but I don't get the correct time. function calcTime(offset) { var d = new Date(); var utc = d.getTime() + (d.getTimezoneOffset() * 60000); var nd = new Date(utc + (3600000*offset)); alert("The local time is "

Php Set TimeZone

爷,独闯天下 提交于 2019-12-05 22:32:58
I have following code: $date = new DateTime(date("Y-m-d H:i:s"), new DateTimeZone('Asia/Karachi')); echo $date->format('Y-m-d H:i:s'); Output: 2015-08-26 17:46:05 Actual Result should be: 2015-08-26 13:46:05 How to set the time zone, so that actual output comes? use this line in your codes date_default_timezone_set("Asia/Karachi"); like <?php date_default_timezone_set("Asia/Karachi"); echo date('d-m-Y H:i:s'); ?> Method 1 (Editing Php.ini) 1) Open your php.ini file 2) Add the following line of code to top of your php.ini file date.timezone = "Asia/Karachi" 3) Restart php. Note: You can find a

Convert `Java.lang.String` TO `oracle.sql.TIMESTAMPTZ`

谁都会走 提交于 2019-12-05 18:30:21
问题 I have these following Java.lang.String values that represents String value of TIMESTAMPTZ . I need to convert these Java.lang.String TO oracle.sql.TIMESTAMPTZ . "2016-04-19 17:34:43.781 Asia/Calcutta", "2016-04-30 20:05:02.002 8:00", "2003-11-11 00:22:15.0 -7:00", "2003-01-01 02:00:00.0 -7:00", "2007-06-08 15:01:12.288 Asia/Bahrain", "2016-03-08 17:17:35.301 Asia/Calcutta", "1994-11-24 11:57:17.303" I tried it by many ways. Sample 1: Tried it by using SimpleDateFormat String[] timeZoneValues

Is UNIX time universal

ⅰ亾dé卋堺 提交于 2019-12-05 16:06:46
I did some research on internet but still confused. Is UNIX time universal time like GMT/UTC or does it vary from place to place like a local time? I know UNIX time is counted from 1st Jan, 1970 00:00:00 GMT. When I use getTime() function in Java (more specifically Date d= new Date(); long currentTime d.getTime()) I am getting the UNIX time in milliseconds. Now If person A and person B use the same function who are sitting in two different time zones, will they get the same result? Jon Skeet Now If person A and person B use the same function who are sitting in two different time zones, will

c/c++ strptime() does not parse %Z Timezone name

会有一股神秘感。 提交于 2019-12-05 10:29:46
I am new to C. When I practicing C to covert time sting to structure tm back and forth. I noticed some difference. Please advice what I did wrong. #include <string.h> #include <stdio.h> #include <time.h> /* test different format string to strptime " %A, %b %d, %X %z %Y " " %A, %b %d, %X %Z %Y " */ int main(int argc,char *argv[]) { char date[] = "6 Mar 2001 12:33:45"; char fmt[80]; struct tm tm; if (argc==1) return 0; strcpy(fmt,argv[1]); memset(&tm, 0, sizeof(struct tm)); if (strptime(date,"%d %b %Y %H:%M:%S",&tm)==NULL) printf("error\n"); char buf[128]; strftime(buf, sizeof(buf), fmt, &tm);

timestampTz fields in Laravel

和自甴很熟 提交于 2019-12-04 20:56:17
Laravel 5.4 supports the Postgres TIMESTAMP WITH TIME ZONE field type in migrations: $table->timestampTz('scheduled_for'); Laravel can be set up to convert date fields ( DATE , DATETIME , TIMESTAMP ) into Carbon objects (and does so by default for the created_at and updated_at TIMESTAMP fields), but putting scheduled_for into the $dates field causes an error with the timezone-aware version: InvalidArgumentException with message 'Trailing data' Looking in the database and tinker, the field's value appears to be something like 2017-06-19 19:19:19-04 . Is there a native way to get a Carbon object

ORACLE Casting DATE to TIMESTAMP WITH TIME ZONE WITH OFFSET

柔情痞子 提交于 2019-12-04 18:23:56
问题 I need to cast a DATE value in a query to a TIMESTAMP WITH TIME ZONE, but currently I'm getting the TimeZone Region ('Europe / Paris') which is not valid to be used by EF. For example, when doing this: select CAST(FECHA AS TIMESTAMP WITH TIME ZONE) from test; I currently get this output: 07/03/14 09:22:00,000000000 EUROPE/PARIS But I need it to be like: 07/03/14 09:22:00,000000000 +01:00 Any idea how to accomplish this? 回答1: You can cast the DATE to a TIMESTAMP , then use FROM_TZ to convert

time zones in POSIXct and xts, converting from GMT in R

一笑奈何 提交于 2019-12-04 06:30:57
I have a bunch of 1 minute returns in an xts object with the index being POSIXct and time zone being GMT. The returns are on NYSE so I would like to convert to the eastern time zone but I would like to take care of the daylight savings time properly. What is the best way of doing this? I am a bit confused between the EST timezone and the EDT timezone. I would like my times to convert properly to the NY time in winter and summer. Use indexTZ<- and the America/New_York timezone > tail(SPY) SPY.Bid.Price SPY.Ask.Price SPY.Trade.Price SPY.Mid.Price SPY.Volume 2012-08-09 19:54:00 140.47 140.48 140

Unexpected results from SQL query with BETWEEN timestamps

人走茶凉 提交于 2019-12-04 05:51:16
问题 I have created a little test app to track down a problem I experienced with Postgres on Heroku: http://snippi.com/s/xd511rf As you can see in line 49 , I want to retrieve all entries created today . This would be the first two items of my test data with the Ruby Gem DataMapper . When I run this app on my notebook (Ubuntu 12.10, HP, Ruby 1.9.3) everything I get this result, which is right: [ { "id": 1, "text": "Working on some awsomenewss", "category": 0, "starttime": "2013-03-21T15:56:00+01

ORACLE Casting DATE to TIMESTAMP WITH TIME ZONE WITH OFFSET

自古美人都是妖i 提交于 2019-12-04 01:56:17
I need to cast a DATE value in a query to a TIMESTAMP WITH TIME ZONE, but currently I'm getting the TimeZone Region ('Europe / Paris') which is not valid to be used by EF. For example, when doing this: select CAST(FECHA AS TIMESTAMP WITH TIME ZONE) from test; I currently get this output: 07/03/14 09:22:00,000000000 EUROPE/PARIS But I need it to be like: 07/03/14 09:22:00,000000000 +01:00 Any idea how to accomplish this? You can cast the DATE to a TIMESTAMP , then use FROM_TZ to convert this timestamp to a timestamp with time zone: SQL> SELECT from_tz(CAST (SYSDATE AS TIMESTAMP), '+01:00') tz