Skip to content
Advertisement

Spliting Daterange values of jquery in two PHP variables

I am having a daterangepicker in form which grabs value in this format 10/12/2020 - 10/16/2020 i am passing this value using ajax to a PHP page for storing in Database. But I want to split daterange in to two variable for example from_date and to_date. i.e

JavaScript

I am not able to split these values in this format

Advertisement

Answer

You can use explode() for this and for the formatting date() combined with strtotime():

JavaScript

Now you have

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement