timestamp-with-timezone

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

筅森魡賤 提交于 2019-12-22 06:39:11
问题 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,"

How can i insert timestamp with timezone in postgresql with prepared statement?

只愿长相守 提交于 2019-12-22 03:25:32
问题 I am trying to insert to a timestamp with timezone field of my DB a string which includes date, time and timezone using prepared statement. The problem is that Timestamp.valueof function does not take into consideration the time zone that the string inludes so it causes an error. The accepted format is yyyy-[m]m-[d]d hh:mm:ss[.f...] which does not mention timezone. That is the exact code that causes the error: pst.setTimestamp(2,Timestamp.valueOf("2012-08-24 14:00:00 +02:00")) Is there any

timestampTz fields in Laravel

懵懂的女人 提交于 2019-12-21 23:59:08
问题 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

Change timezone component of TIMESTAMP WITH TIMEZONE in Oracle

早过忘川 提交于 2019-12-19 19:54:40
问题 I have some data that is stored in a TIMESTAMP(6) WITH TIMEZONE column in Oracle, but it is stored in the wrong timezone. By convention, all timestamps in the DB must be stored in UTC, but this data was incorrectly persisted as EDT. The actual values are equivalent to the correct UTC value; the problem is simply that it is stored as 19-JUN-12 12.20.42.000000000 PM AMERICA/NEW_YORK when instead it should be 19-JUN-12 16.20.42.000000000 PM UTC . Is there any way in Oracle to change this? 回答1:

Tsrange - Calculating the difference between two ranges

不羁的心 提交于 2019-12-13 17:23:56
问题 I have two tables free_time and appointment . Both contain tsranges. How do I write a query (or function) that determines the actual free time after "subtracting" the difference the appointment from the freetime ? INSERT INTO free_time(freetime) VALUES('[2017-04-19 09:00, 2017-04-19 12:30)'); INSERT INTO appointment(appointment) VALUES('[2017-04-19 10:30, 2017-04-19 11:30)'); I want the result to be something like: ["2017-04-19 9:00","2017-04-19 10:30:00"), ["2017-04-19 11:30:00","2017-04-19

Managing timezone & DST issue for javascript application

偶尔善良 提交于 2019-12-13 04:37:22
问题 I am trying to create a scheduling application. The front end\UI is developed using JavaScript. The back end is a ASP.NET Web Api application which uses MSSQL server as the database. From the UI, user will schedule a job which can run daily/weekly/monthly. Each job can run for maximum of 3 months. The job will run on the server side at the specified time. Assume user come and selects a job which will run for a week (From 23-Nov to 29-Nov) at 10 AM local time. In this case, I will make seven

Counting rows in event table, grouped by time range, a lot

自古美人都是妖i 提交于 2019-12-13 03:51:09
问题 Imagine I have a table like this: CREATE TABLE `Alarms` ( `AlarmId` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT "32-bit ID", `Ended` BOOLEAN NOT NULL DEFAULT FALSE COMMENT "Whether the alarm has ended", `StartedAt` TIMESTAMP NOT NULL DEFAULT 0 COMMENT "Time at which the alarm was raised", `EndedAt` TIMESTAMP NULL COMMENT "Time at which the alarm ended (NULL iff Ended=false)", PRIMARY KEY (`AlarmId`), KEY `Key4` (`StartedAt`), KEY `Key5` (`Ended`, `EndedAt`) ) ENGINE=InnoDB; Now, for a GUI, I

Converting GMT time to local time using timezone offset in php

只愿长相守 提交于 2019-12-13 03:38:26
问题 I need to display user's activities date as per the current time zone. My approach - Getting a timezone offset from javascript and storing it to the user's profile table. When user logged in, getting time zone offset. current date is working fine with time zone offset- $offsetDiff = $_SESSION['TimeZone']*60; $UserDateTime = time() + $offsetDiff; $currentDate = date('Y-m-d',$UserDateTime); Dateo other then today is not working properly - $offsetDiff = $_SESSION['TimeZone']*60; $UserDateTime =

Organizing dates with times and timezones. (Converting to accurate timestamp.)

有些话、适合烂在心里 提交于 2019-12-13 02:29:19
问题 I've been picking at my brain for a couple of days with the following conundrum. I've basically the following complex mySQL table: | ID | TITLE | DESCRIPTION | EVENT | DATE | |----|--------------|-------------------|-------|-------------------------| | 1 | Big painting | 3-day work | No | 03/10/2013 | | 2 | Meeting | With reps. | Yes | 02/15/2013 09:00 -05:00 | | 3 | Presentation | 5 paintings | Yes | 08/02/2013 22:00 +02:00 | | 4 | Round paint. | One week | No | 04/05/2013 | | 5 | Conference

Converting Between Timezones in Postgres

爷,独闯天下 提交于 2019-12-12 16:33:18
问题 I am trying to understand the timestamps and timezones in Postgre. I think I got it, until I red this article. Focus on the "Converting Between Timezones" part. It has two examples. (Consider the default timezone configuration to be UTC.) Example 1 db=# SELECT timezone('US/Pacific', '2016-01-01 00:00'); outputs 2015-12-31 16:00:00 According to the article and what I understand, because the '2016-01-01 00:00' part of the timezone function is just a string, it is silently converted to the