Skip to content
Advertisement

“From 10 to 20 March 2020” i need this date format from two dates

I have a start date and end date.

From those dates i need to print the dates in the below formats.For example:

  • Start Date:10/03/2020
  • End Date:20/03/2020

Needed Format :

  • From 10 to 20 March 2020
public function EventPromo($id){
    $event=events::where('id',$id)->with('Organization')->get();
    return view('participants.preview',compact('event'));
}

From this i only get startdate format. I need to combine both start and end date.

In laravel blade:

{{ date('l jS \of F Y ', strtotime($event[0]->startDate)) }}
[enter image description here][count down of dates] form this start and end date i need to show how many days,hours,mins,sec for the event has to come and near.
<section class="section-swiper-content">
    <div class="container-fluid">
        <div class="row justify-content-lg-center countdown-container">
            <div class="" data-end-time="2020-03-10T00:00:00-03:00">
                <div class="countdown-member">
                    <span id="countdown-days" class="countdown-member-number">0</span>
                    <span id="countdown-days-label" class="countdown-member-label">Dias</span>
                </div>
                <div class="countdown-member">
                    <span id="countdown-hours" class="countdown-member-number">0</span>
                    <span id="countdown-hours-label" class="countdown-member-label">Horas</span>
                </div>
                <div class="countdown-member">
                    <span id="countdown-minutes" class="countdown-member-number">0</span>
                    <span class="countdown-member-label">Min</span>
                </div>
                <div class="countdown-member">
                    <span id="countdown-seconds" class="countdown-member-number">0</span>
                    <span class="countdown-member-label">Seg</span>
                </div>
            </div>
        </div>
    </div>
</section>

Advertisement

Answer

If you will always have it in same month:

From {{ date('j', strtotime($event[0]->startDate)) }} 
to  {{ date('j', strtotime($event[0]->endDate)) }} 
    {{ date('F Y', strtotime($event[0]->endDate)) }} 
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement