Questions tagged [sqldatetime]

The SQLDateTime tag is for questions related to how database SQL queries handle date and time information.

Databases can store date and time information in various ways. The is used for questions related to defining and accessing date/time data. Some considerations for this type of data are

  • Precision
  • Calculations
  • Business rules
  • Scheduling

Most database software allows date types that include both the date and time of day. There are various types of date types that can include timezone information, and interval information.

See the for questions relating to functions used for determining things such as last_day(date) which returns the last day of the month for the specified date, and functions for returning the current date or timestamp.

177 questions
0
votes
2 answers

Java / SQL -How to group time in intervals of 30 minutes or 1 hour

I need a solution to group the times of entry and the display the respective time interval and count of users/records during that time interval eg Time Interval Count 07:00 AM-07:30 24 12:30 PM-13:00 26 How can we group time based on interval…
0
votes
1 answer

Pass sql date from talend to Rest Api

I want to send a post request to the rest API which includes an SQL date format, when I try to send the request with YYYY-MM-DD format, its showing bad request. How to properly send the data.
Bimal Sunil
  • 23
  • 1
  • 1
  • 4
0
votes
3 answers

Convert a Text to a DateTime in access

So i have a field that datatype is a text which is feed into the database. What it returns is something along the lines of this: ddd MMM dd hh:mm:ss yyyy What i would like for it to do is be displayed as something like this: ddd MMM dd yyyy…
James213
  • 957
  • 5
  • 31
  • 57
0
votes
1 answer

Conversion failed Error SQL Date format Mismatch with C# Datatable datetime fromat depending on system calender setting

We have a Stored Procedure in SQL Server which expects datetime column to be in MMddyyyy format and results in error Conversion failed when converting date and/or time from character string. whenever the system calendar setting is set to ddMMyyyy…
0
votes
1 answer

How do I import Dates from Excel to SQL Server varchar column in m/d/yyyy format?

I have an excel from where I am bulk importing data to SQL server through .Net code (Dataset.WriteToServer method). Now, my excel has dates in m/d/yyyy format, e.g. 9/21/2021. The destination SQL Server column is varchar and I would prefer not to…
0
votes
1 answer

cannot insert datetime field with stored procedure into mysql database

I am getting this syntax error when trying to insert a datetime into mysql database. pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to…
vkan
  • 123
  • 4
0
votes
1 answer

datetime comparison between two columns of two different tables in sql Server

i have 2 tables who includes thes sames colums but the differentes data. TOOLS DATE ----------- ---------------------- A10MA17 2021-09-25 05:14:16.000 x10UA50 2021-09-25 05:06:50.000 LU0NV03 …
0
votes
2 answers

Snowflake Split bigger time interval in monthly intervals

I have a table which has different interval invoice. Please see sample data below: Invoice_Start_Date Invoice_End_Date Amount 1/1/2019 2/1/2019 12 1/1/2019 1/1/2020 84 1/1/2019 1/1/2021 140 I…
0
votes
1 answer

Conversion of date data type to datetime resulted to invalid date

I am trying to covert date value to datetime in SQL with the following query,which is resulting to invalid value: select convert(datetime,date_1, 25) from table1; date_1(of data type date): 2019-12-02 expected o/p: 2019-12-02 00:00:00.000 actual…
0
votes
1 answer

Find minimum overlap of Each Status

I need to find date ranges where status is Missing/Not Ready in all the groups ( Only the overlapping date ranges where all the groups have status of missing/notready) ''' ID. Group. Eff_Date. Exp_Date Status 1. 1 …
0
votes
2 answers

How to convert CST to UTC in MSSQL

Is it possible to convert CST to UTC in MSSQL? For example: convert Thu May 13 11:14:19 CST 2021 to 2021-05-13 11:14:19.000
Derek
  • 3
  • 2
0
votes
1 answer

Convert a column of type varchar(255) to type date in PostgreSQL

I'm a new in SQL and I'm trying to convert a column of type varchar(255) to datetime (yyyy-mm-dd). I found some advice to convert one element but how can I convert entire column to a new datatype? My table is mydemo and the column to convert is…
Duc Anh Ho
  • 21
  • 4
0
votes
2 answers

DbFunctions or similar to compare time of day of a datetime type column in Linq to Entity Framework

I know there is a function to compare just the date of a datetime type column, but what if I want to only compare the time of it to another time. Is there a function in Linq To Entities? DbFunctions.TruncateTime(q.EndDate.Value)
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
0
votes
3 answers

Calculate start date of almost equal periods

SQL Server CREATE TABLE [TABLE_1] ( PLAN_NR decimal(28,6) NULL, START_DATE datetime NULL, MAX_PERIODS decimal(28,6) NULL, ); INSERT INTO TABLE_1 (PLAN_NR, START_DATE, MAX_PERIODS) VALUES (1, '2020-05-01', 8), (2, '2020-08-01',…
Peter S
  • 625
  • 1
  • 9
  • 32
0
votes
0 answers

How can i input the correct Timestamp corresponding to the time, when the data was retrieved in sqlite3?

I am modifying a code snippet from a udemy course, to fit my goal. My goal - > being able to store the timestamps in a sqlite3 database corresponding to the actual time the data was retrieved. The original code excerpt to update the database from…
Sriram
  • 1
  • 1