Questions tagged [date]
Questions related to date or date-related functions, data-types, representations (how dates might be stored and displayed) and operations (such as subtracting dates, adding intervals to dates).
350 questions
0
votes
1
answer
43
views
Postgresql giving different result when comparing timestamp with date in different time zone
When running the following query, I would expect it to give the same result independently of the session time zone but instead it gives different result depending on the session:
select '2025-09-22' &...
0
votes
1
answer
35
views
SQL Loader rejecting date: column not allowed here When importing date
I am trying to import a file using SQL Loader in Toad and am receiving an error message "ORA-00984 column not allowed here". I previously was getting an error message that there was a non-...
0
votes
1
answer
52
views
Convert Oracle date column to timestamp with time zone
How can I convert a Oracle DATE column to TIMESTAMP WITH TIME ZONE without losing the content of that column?
6
votes
3
answers
717
views
Unexplained MSSQL default date formatting
I have a problem with T-SQL that is out of my control.
Their T-SQL is failing to work with a date that was cast to VARCHAR(10). They are expecting to get the default yyyy-mm-dd (the documented default ...
2
votes
1
answer
351
views
Loading a CSV into mariadb errs out as "invalid date format"
I am trying to load CSV into a MariaDB .
Having issues in transforming date .
Here is an example file and two tables
( emp , where dob is declared as a date column and emp_varchar , where dob is ...
8
votes
2
answers
2k
views
Is an invalid date considered the same as a NULL value?
I am using MySQL 5.7 and I have notice something which I cannot explain to myself with my current knowledge so here it goes.
Is an "invalid" date 0000-00-00 considered same as NULL for a ...
-2
votes
1
answer
77
views
Why is it selecting date from another month that requested one? [closed]
I have a table that store time begin and time end of some events. I want to search in this table all even that were occuring during specific day.
Here is example data:
Id
Date begin
Date End
Name
1
...
0
votes
3
answers
155
views
what's the bests practices in date
What's the best practices with a date field when you want to fill in the fact that it's not filled in and not leave it NULL?
should you put 1999-01-01, 9999-09-09, 1890-12-31...?
Are there any rules ...
1
vote
2
answers
297
views
How to generated missing dates between date range that do not exist in the joined table in CockroachDB?
I have Table A and Table A which have
Table A
id, start_date, end_date
Table B
id, table_a_id, archive_date
I want to return the dates that are missing in Table B, the dates that are NOT in the ...
0
votes
1
answer
148
views
How to generate most recent nth day of the month?
Simple question, but I haven't found any examples of this on Stack Exchange:
I need to be able to select all records in the current billing cycle, that's it. The catch is the billing cycle doesn't ...
0
votes
0
answers
92
views
Complex day-to-day difference of historical data in SQL server
Setting:
I have a table (let's call it "HistoricalData") with 10 attribute columns, a date (in string format) and a value. The table has a unique clustered index on (date, idcol1, idcol2,.....
0
votes
1
answer
36
views
I am getting an infinite fetch duration when adding a similar third left join
I am using MySQL on Windows 10.
The query below should result in three groups of data sets that are different only in the date range. It works for any two date ranges but when I try to run all three ...
3
votes
5
answers
3k
views
Optimizing SQL Server Query When Joining Tables on DATETIME column
I am working with SQL Server and I have two tables, table1 and table2. Both tables have a DATETIME column denoted as dt. I need to join these tables based not only on certain conditions but also to ...
1
vote
2
answers
78
views
TSQL count 2 different columns by using number table
I am trying to count 2 different date columns on a monthly interval by using a number table:
numbers table:
num
0
1
2
3
Originating Table (Example):
Gender
Subscription_Date
Cancel_Date
male
2023-01-...
0
votes
1
answer
146
views
How to join matching Date fields as intervals?
Let say I've a table with a list of id/year/month (two years + 24 months for semplicity here):
Code Year Month
MAT000000001 2022 1
MAT000000001 2022 2
MAT000000001 2022 ...