convert weird date string into date format in pyspark

I have a csv file with the date column. The date is coming in a strange format. Below are some examples: May the 9th of 2022 September the 17th of 2022 June the 09th of 2022 I am creating a glue job to load data into Redshift. How do I convert these weird looking string… Read More convert weird date string into date format in pyspark

How to convert a column value which is like 20220401 of number datatype to 2022-04-01 in snowflake

I have a column of number data type in snowflake that stores values like 20220401, now I need to convert it into date format. Could someone please help >Solution : select to_date(’02/14/2014′, ‘MM/DD/YYYY’); create table number_to_date(numbers integer); insert into number_to_date values (20220401); select to_date(to_char(numbers),’YYYYMMDD’) from number_to_date; More details: https://docs.snowflake.com/en/sql-reference/functions/to_date.html#examples

new DateTime is not working properly with the future date

I am trying to calculate the differences between 2 dates. The first date is the reservation date, and the second date is the traveler’s birthdate. Format of the $tour_day is 15 December, 202X $date1 = new DateTime($bir_day); $date2 = new DateTime($tour_day); $interval = $date1->diff($date2); if( ($interval->y <= 8 && ($interval->m > 12 || $interval->d >… Read More new DateTime is not working properly with the future date