I have a Varchar like so: 23FEB2025 I am trying to convert it into a format like: 1994-02-23 or YYYY-MM-DD I have tried select cast (’23FEB2025′ as date format ‘yyyy-mm-dd’); and sel convert(date,’…
Tag: date
Categorize datetime value to shifts where shift ends on the next day
I have a MySQL query for example: My table only have qty and filedatetime columns. Based on this query is it possible to query out the following conditions: if filedatetime is filedatetime >= ‘2019-08-01 06:30:00’ and filedatetime < ‘2019-08-01 18:30:00’ then assign value ‘Day’ to column shift assign value ‘2019-08-01’ to column shiftDate if filedatetime >= ‘2019-08-01 18:30:00’ and filedatetime
Convert varchar to date in Oracle SQL with month name
I have 2 columns in a large data set. Col 1 “review_date” is a varchar “September 16, 2019” I would like to have this information in DATE format as 09/16/2019 Col 2 “complete_date” is a varchar “…
SQL to return 1 for each row with column range in 2017 or 2018 or 2019
I have a query that looks like this: SELECT DISTINCT p.person_ID ,p.Last_Name ,ISNULL(p.Middle_Initial, ”) AS Middle ,p.First_Name ,sh.Status_from_date ,sh….
How to get the row of a row set with the highest date in SQL?
Table 1: ID : AnotherID : text : updateDate ——————————————— 1 : 1 : test1 : 2019-08-08 15:14:19 2 : 1 : test2 : 2019-08-08 15:15:46 3 : 2 : …
ERROR: varchar data type to a datetime data type resulted in error out-of-range value
I get this error message when I run the below query. Do you have any idea how I can solve this error? varchar data type to a datetime data type resulted in error out-of-range value I have been …
Create new date ranges from overlapping date ranges and assign an ID
I have the following table ID | START_DATE | END_DATE | FEATURE ————————————— 001 | 1995-08-01 | 1997-12-31 | 1 001 | 1998-01-01 | 2017-03-31 | 4 001 | 2000-06-14 | 2017-…
In SQL how to calculate days in a year based on a start date and the number of days lapsed
What would be the SQL to calculate the number of days in each year if I had a start date and the number of days that have lapsed? For example, the date (ymd) 2013-01-01 and the days lapsed is 1000. …
Change empty string to NULL when column has DATE constraint
This might be impossible but I was wondering if someone more experienced knew if this is possible to do in postgresql. I have a column in my create statement CREATE table IF NOT EXISTS (other cols, …
Find How many minutes a month has: MySQL
Say I have a column Date 23-03-2019 04-04-2019 I want to find hoe many minutes the whole month has in MySQL. Expected output: Date MinsinMonth 23-03-2019 44640 04-04-2019 …