Questions tagged [datediff]

Date-difference will give difference in the number of days, months, years etc. between any two calendar dates. Not defined by ISO/ANSI SQL, but several vendors have similar implementations.

1599 questions
0
votes
0 answers

Count many weeks between current date and the date on sqlite database Android

I've got a question about counting the weeks between the current date and the date on SQLite. I am trying to put date data on DBAdapter Class to SharedMemory : SharedPreferences user = getSharedPreferences(USER, 0); SharedPreferences.Editor editor =…
wdyz
  • 185
  • 4
  • 19
0
votes
1 answer

How to make a sql loop query to check difference between values?

first of all, I'm not a native english speaker and this is a hard to explain issue. If you have any doubts, please let me know. We're using a GPS vehicle tracking device, which is programmed to send and store in a DB the position of the vehicle…
Heinser Diaz
  • 123
  • 4
  • 15
0
votes
2 answers

How do I execute scripts based on what month/day it is?

Okay, I feel like I should be able to do this, but I have searched to no avail. I need to show one of two different data sets depending on what day of the year it is. Specifically, if today is October 31 (or earlier,) I want to pull all entries…
gmaness
  • 154
  • 1
  • 12
0
votes
4 answers

C# forms - Getting time between two dates

I'm trying to find the time between two dates, one being the current day (Today) and the other, a user defined deadline. I'm working with C# Windows Forms and I've used a "date time picker" so that the user can choose a deadline date and I've…
Raker
  • 13
  • 1
  • 6
-1
votes
2 answers

MySQL DateDiff <= 35

I am trying to run a MySQL query but I am having trouble with DateDiff. I have 2 date fields payment and expiry. I want to select the Difference in dates between expiry and payment which are less than or equal to thirty five days. How can I use…
StefanHanotin
  • 191
  • 5
  • 17
-1
votes
2 answers

Can't get the code to get difference between 2 dates in JavaScript

I need a user input for 2 dates, and get the difference between them, and if it is more than 14 days, throw an error. Help appreciated The date is in the format yyyy/mm/dd Also, I want to match the pattern of the date to check if it is valid, I have…
sid0972
  • 53
  • 2
  • 7
-1
votes
1 answer

Google Sheets Automate Days Calculation for different Buy Date and Sell Date

I have a google sheet where Column A has Buy Date and Column L has Sell Date. Column B to K has several other data. There are multiple buys on different dates but selling is on a single date. What I want is the difference between the buy date as…
-1
votes
2 answers

Finding age in dd:hh:mm:ss:ms format in SQL Server

I have a SQL Server instance and with a date table with datetime values. I have been trying to write queries to find the age of those columns by subtracting the current time value from the column values using GETDATE(). I have tried queries like the…
JohnMenx
  • 9
  • 2
-1
votes
1 answer

SQL End of Quarter Date Diff and filter

I have a data set with repeating date values within a quarter, I'd like to select the closest date to the quarter end. Existing data The output I'm tryting to acheive would look like this select created_at, account_id, …
Ricky
  • 123
  • 9
-1
votes
1 answer

How to count the number of days in Mysql where an event has happened in a row consecutively daily?

See table dataHow to count the number of days in MYsql where an event has happened in a row consecutively daily? CREATE TABLE MrDataConverter ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, num INT, controller_id INT, event_type INT, date…
Ligia C
  • 3
  • 2
-1
votes
1 answer

Power Bi DATEDIFF column 'date1' in table 'table1' cannot be found of may not be used in this expression

Does anybody here know why is this happening. I have 2 dates column in a table, 'Date of First Contact' and 'Date of Last Activity'. Can someone enlighten me why is this happening? Thank you in Advance
Jj Encrypt
  • 11
  • 5
-1
votes
1 answer

how to validate 2 dates (cannot be different months)

firstDate secondDate 2022-12-02 2023-01-02 .. ... the second date of the month follows the first date of the month, so the month of the date is can't be different result like this : | firstDate | secondDate | | --- | --- | | 2022-12-02…
-1
votes
1 answer

Find first value with datediff larger than 1 week from table and join with initial table

I have two tables: dbo.HistPrices (Which has all Historic Prices for every PId and some non interesting metadata... etc. ) PId (non-unique) Price Pricedate ... 1 5 2022-11-03 2 3 2022-11-03 2 (more than 1 date per…
NorrinRadd
  • 545
  • 6
  • 21
-1
votes
1 answer

Get the the number of days difference from one column with multiple and different values to other column

I need help how to get the number of day(s) difference in SQL query. Comparisons are made between one date column (Billing Date) with numerous, different value and one date value only (Date Generated). Values: Date Generated:…
-1
votes
1 answer

SQL datediff translation

I am not a SQL user, it happens that I need to know what this type of SQL code means, can you help me please translating it to me? CASE WHEN DATEDIFF(to_date(B.DT_CAREPACK_END), LAST_DAY(date_sub(add_months(current_date, 3),…
1 2 3
99
100