I have a table of users that have joined and the column that tracked the timestamp of when they joined is a UNIX timestamp. I want to group them by a weeks time in seconds, 604800, but am running into a roadblock. The other searches use MySQL week, but that is not what I am after since those weeks are
Tag: datetime
How to Use Dates in Where Clause in EF Core?
I need to filter my queries by dates but I don’t care in this case about time portion of it that is stored in SQL Database. I first tried to something like var now = DateTime.Now.Date; Where(x => …
Get all days in a month excluding weekends postgresql
I want to write a query sql for postgresql that can basically return me all days of a month excluding weekends. For example (For 11/2019) : First Week: 11/1 Second Week : 11/4 -> 11/8 Third Week : 11/11 -> 11/15 Fouth Week : 11/18 -> 11/22 Fifth Week : 11/25 -> 11/29 I can’t find any postgresql request that
SQLDateTime OverFlow with Correct DateTime Format
below is my code snippet where I insert a DateTime value to SQL database and encountered the following error: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. May I know if there is a format to be used? when converting the value of row.DeliveryDate? Answer actually the problem is SQL DateTime =/= C# Datetime you
Create a calendar database table like this
I would like to create a calendar SQL table like this one but for some years. (I’m using mysql 5.7.28) Date is DD-MM-YYYY Is it possible? Answer If you are running MySQL 8.0, you can use a recursive query: The recursive cte generates a list of datetimes between the given boundaries (here, that’s year 2019), with a 1 hour increment.
Convert character string into this specific date format?
I am using SQL Server 2014 and I have a table (t1) which contain a column (ReviewDate) in the nvarchar format. An example of a row of this column is given below: I need to extract the “date” component from this character string. To do this, my T-SQL is as follows: This gives me “Oct 2017”. Now, I want to
How to get how many hour 4AM have there been between two dates in TSQL
I need to get how many of a specific hour have occurred between two dates in TSQL. Some examples: The following would give the result = 1 declare @date1 datetime = ‘2019-10-01 00:00:00.000’; declare …
What is the purpose of the string “- 4/24” from a record that holds a date?
I have an already generated script that uses the following code: ORDER BY TO_CHAR((A.VERIFIED_DTTM – 4/24),’YYYY-MM-DD’). The output of A.VERIFIED_DTTM is a simple date eg: 09-SEP-19. I was my …
How to convert decimal to time in Oracle SQL?
In a certain table I’m querying, time is stored like this: 09:30 is stored as 9,3 14:25 is stored as 14,25 How can I, using SQL, convert 9,3 to 09:30 (hh:mm format)? So far, the only thing I could …
Why Week conversion failed in SQL Server in my case?
I am trying to convert week of the date based on my criteria. My date condition: if my @date is less than 4 AM, then @date – 1, else @date declare @dates datetime set @dates = ‘2019-01-01 03:59:59’…