Use Carbon (http://laravel.com/docs/5.1/eloquent-mutators) once the date is setup as an instance of Carbon you can do simple things such as:
$user->dob->format('d-m-Y')
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I have defined a migration in which I have a date field i.e, dob. How to set the date format for it?
Example: public function up() { Schema::create('contacts', function (Blueprint $table) { $table->increments('contactid'); $table->string('name', 75)->nullable(); $table->string('email', 100)->nullable(); $table->timestamp('dob')->nullable(); $table->timestamps(); }); }
Thanks Santosh
Please or to participate in this conversation.