Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Format Laravel Timestamps in Front End with Javascript

I want to format the Laravel date format generated by timestamps, but I want to do that in the front end with Javascript, the time value is something like this 2022-01-03T19:16:16.000000Z, so what I want to do is to format it to something like this: 02 Jan 2021

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Here's a previous post on how you can accomplish this: How to handle datetime between php (Laravel api) and javascript (AngularJS)

However, it's worth noting that Laravel handles this for you. See documentation on Date Casting.

/**
 * The attributes that should be cast.
 *
 * @var array
 */
protected $casts = [
    'created_at' => 'datetime:Y-m-d',
];

As the post suggests you can use momentjs:

correctTime = moment('<YOUR_UTC_TIME_STRING>').format();
about 4 years ago · Juan Pablo Isaza Report

0

You don't need to format it in your frontend, you can use carbon to accomplish that task in your laravel backend, it is simple and straight forward

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!