Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jeyziii's avatar

How to show date in date form

How to show the data in the date field. I also tried without the date() function it also does not show the data in the field.

Form:

<div class="form-group">
{{Form::label('schedule post', 'Schedule Post', ['class' => 'control-label mb-1'])}}
{{Form::date('pubish_date', date('F j Y', strtotime($article->published_at)))}}

{{Form::label('remove post', 'Remove Post', ['class' => 'control-label mb-1'])}}
{{Form::date('remove_date', date('F j Y', strtotime($article->expired_at)))}}
</div>

Output: https://pasteboard.co/egQMBz5nASyl.png

0 likes
5 replies
Jeyziii's avatar

@cwhite Tried it still the same.

<div class="form-group">
{{Form::label('schedule post', 'Schedule Post', ['class' => 'control-label mb-1'])}}
{!! Form::date('pubish_date', date('F j Y', strtotime($article->published_at))) !!}

{{Form::label('remove post', 'Remove Post', ['class' => 'control-label mb-1'])}}
{!! Form::date('remove_date', date('F j Y', strtotime($article->expired_at))) !!}
</div>
cwhite's avatar

@Jeyziii, You need to do it for all Form:: calls (including Form::label).

1 like
cwhite's avatar
cwhite
Best Answer
Level 19

Also, cast published_at and expired_at to datetime in the Article model, and then you can just call $aticle->expired_at->format('F j Y')

1 like

Please or to participate in this conversation.