skip to Main Content

Format date from YYYYMMDD to YYMMDD in Javascript

I have this code which shows the year in YYYYMMDD format. I would like the output to be in YYMMDD format. Basically to replace 2014 to 14 only. let date = new Date(); let timeNow = new Date(date.valueOf()-60*1000*date.getTimezoneOffset()).toISOString().substring(0, 10).replace(/-/g,""); console.log(timeNow);…

VIEW QUESTION

Laravel date->format is not working at whereDate()

$period = new DatePeriod( new DateTime( '2024-03-20 00:00:00' ), new DateInterval('P1D'), new DateTime( '2024-03-28 23:59:59' ) ); $orders = OrderProduct::where ('brand','<>','NULL'); foreach ($period as $date){ $labels[] = $date->format('d-m-Y'); $searchDate = $date->format('Y-m-d'); **//This doesn't work** //$searchDate = '2024-03-26'; **//This works** $order…

VIEW QUESTION
Back To Top
Search