How to get PHP Timestamp on JS
I want the formatting to be similar to this:
2018-02-09 00:00:00
Use Carbon.
If it's already a Carbon datetime instance (like the model timestamps created_at and updated_at, you can do this:
$dt->format('Y-m-d H:i:s');
If it's not a Carbon instance, try this:
Carbon::parse($timestamp)->format('Y-m-d H:i:s');
@arukomp I should have provided more info
Here is my JS:
document.getElementById("date").value = i-need-to-fill-this-part;
Not sure how i should continue from here.
Forget Carbon. Use Moment if you want to muck about with dates in JS.
Nice. Moment worked just fine. Thanks
Please or to participate in this conversation.