I've got a string with dates from date picker and diveded it on two parts: `from` and `to`.
Both parts has been converted into time.
This code returns two variables called $from and $to which can be used in the code.
--
50 грн кэшбека при оформлении карты MonoBank: https://monobank.ua/r/Zd6LxX
--
Payeer: P1076541811
--
Крипота:
usdt: 0x03f423C10afa3425727c2aa17ce12763532990Cd
btc: bc1qvgcc7xdy00wy4u7h5hg40xqd9jsltc9ke4jgy6
eth: 0x03f423C10afa3425727c2aa17ce12763532990Cd
zil: zil17ehwnnt4ckh276vf0d3ezrcathurtvfxvzepv9
sol: 4myPNvsNapUBoHe5hN9zx8b2vLyFon2NEZ27SVW7Q8Fy
I've got a string with dates from date picker and diveded it on two parts: `from` and `to`.
Both parts has been converted into time.
This code returns two variables called $from and $to which can be used in the code.
/** * How to use * list('from' => $from, 'to' => $to) = Date::getRangeDatePicker($string); * We've got 2 variables: $from && $to */ public static function getRangeDatePicker( ?string $dateRange) :array { $range = explode('-', $dateRange ?? ''); $from = !empty($range[0]) ? date('Ymd', strtotime($range[0])) : date('Ymd', strtotime('-1 month')); $to = !empty($range[1]) ? date('Ymd H:i:s', strtotime($range[1] . ' 23:59:59')) : date('Ymd', strtotime('+1 day')); return compact('from', 'to'); }
Делиться материалами сайта категорически рекомендуется, в качестве благодарности - ссылки на источник, и делитесь во благо распространения информации.