Skip to main content

Questions tagged [time]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
57 votes
6 answers
71k views

How to combine date and time to datetime2 in SQL Server?

Given the following components DECLARE @D DATE = '2013-10-13' DECLARE @T TIME(7) = '23:59:59.9999999' What is the best way of combining them to produce a DATETIME2(7) result with value '2013-10-13 ...
Martin Smith's user avatar
  • 86.5k
3 votes
1 answer
1k views

Risk of changing clocktime on MySQL server host

I have a MySQL server host that have a clock that is about 75 minutes wrong. Is there any risk in changing the hosts clock while MySQL is running? Update: Obviously NOW() and other functions ...
Ztyx's user avatar
  • 197
8 votes
4 answers
8k views

PostgreSQL interval division

This has come up a couple of times, e.g., in the postgresql newsgroup and the wiki. In general, the relationship between different intervals may not be well defined - a month can be different numbers ...
beldaz's user avatar
  • 1,730
3 votes
1 answer
3k views

Calculate Difference in Overlapping Time in PostgreSQL / SSRS

I'm using PostgreSQL 9.2 and SSRS 3.0. I'm trying to calculate the difference in non-overlapping time entries in a timesheet. My data looks like this: I would like this to return: I can get the ...
Rob Slone's user avatar
16 votes
4 answers
20k views

How do I generate a time series in PostgreSQL?

If you're looking to generate a date series, see this question Let's say I want to generate a series for every 5 minutes for 24 hours. How do I do that in PostgreSQL? PostgreSQL can generate_series()...
Evan Carroll's user avatar
  • 64.7k
8 votes
3 answers
8k views

Join 2 tables by closest time, PostgreSQL 9.6

I have 2 tables: tbl1, tbl2. CREATE TABLE tbl1(time_1) AS VALUES ( '2017-09-06 15:26:03'::timestamp ), ( '2017-09-06 15:26:02' ), ( '2017-09-06 15:28:01' ), ( '2017-09-06 15:40:00' ); CREATE ...
delkov's user avatar
  • 261
6 votes
1 answer
991 views

What is a valid use case for using TIME WITH TIME ZONE?

Along the lines of this related question: What is a valid use case for using TIMESTAMP WITHOUT TIME ZONE Are there any valid use cases for actually using TIME WITH TIME ZONE or should it be ...
Eduardo's user avatar
  • 163
3 votes
1 answer
26k views

Update value in timestamptz column

I have a table column with the data type timestamptz. Time zone of server is America/Denver. Going through some strange issue while inserting a value in that column. When I update the column to the ...
Harshal Mahajan's user avatar
2 votes
2 answers
6k views

Can we set LOCK_TIMEOUT instance- or database-wide?

It is possible to change the SQL Server's default (which is -1 or indefinite period of time) LOCK_TIMEOUT value session-wide. Is it possible to set LOCK_TIMEOUT default value server-, instance- and/...
Fulproof's user avatar
  • 1,392
2 votes
2 answers
2k views

Does PostgreSQL Explain Analyze Execution Time consider Fetching time

I have some tests on GitHub which record how much time it takes to execute a query and fetch all results. If I check the execution plan, I get: Index Scan using post_comment_pkey on post_comment ...
Vlad Mihalcea's user avatar
1 vote
2 answers
204 views

Time elapsed Calculation

I need to calculated time elapsed for each user to perform his part in a transaction. The sequence is: 0 -1 - B2 or 0-B3 The table looks like the following: +--------+--------+-------------------+---...
Yousef's user avatar
  • 13
0 votes
1 answer
7k views

Querying a date range

i query this SQL query: SELECT * FROM [DB].[dbo].[Table] WHERE [DATE] BETWEEN '01-01-2016' AND '31-03-2016' AND ([TIME] >= '00:00:00' OR [DATE] > '01-01-2016') AND ([TIME] <= '00:00:00' OR [...
Marvin Gerardin's user avatar