0

With this line:

<td><% district.created_at %></td>

I'm getting this output:

2022-08-06T09:14:58.000000Z

It should be like this:

2022-08-06 09:14:58

The correct printout is from Laravel 5.3 and the wrong from Laravel 9. What could be the problem and how to correct?

raffocat
  • 11
  • 6
  • Please clarify - is the problem that you are getting two different dates, or that the format is different? – Ken Y-N Oct 04 '22 at 22:34
  • Sorry, it's the format that's different. Adjusted. – raffocat Oct 05 '22 at 10:26
  • Does this answer your question? [How to change default format at created\_at and updated\_at value laravel](https://stackoverflow.com/questions/24441395/how-to-change-default-format-at-created-at-and-updated-at-value-laravel) – Ken Y-N Oct 05 '22 at 22:44
  • Perhaps there is an answer in that possible dup? – Ken Y-N Oct 05 '22 at 22:44
  • 1
    Ken Y-N No, as the printout is in the form <% district.created_at %> in the blade file (angularjs) so those tips do not apply. The thing is that it works fine in Laravel 5.3 but not in my upgraded Laravel 9 – raffocat Oct 06 '22 at 13:17
  • I have looked around and found out that this is some kind of ASP statement. So it looks like it's a kins of script "Scripts surrounded by <% and %> are executed on the server". But I don't know how this works. – raffocat Oct 07 '22 at 09:31

1 Answers1

0

why not try with a date and day format like YYYY-MM-DD HH-MM-SS

$mytime = Carbon\Carbon::now();
echo $mytime->toDateTimeString();
  • Well, not that simple. The statement <% district.created_at %> is angularjs and I don't know how to address the format. It has to do with the difference between Laravel 5.3 (shows correct format) and Laravel 9 (wrong format). – raffocat Oct 05 '22 at 10:30