PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, April 18, 2022

[FIXED] how to make date & time inputs dynamic

 April 18, 2022     html, laravel, mysql, php, sql     No comments   

Issue

i've form has 2 inputs date/time but its static i have an idea but don't know if its applicable or not.

i want the 2 inputs have default now();

if the didn't change its value it stored to db with the now(); date and time,

but if he changed it to another date and time the stored value be his choice,

is this can be done ?


Solution

use laravel helper function

now()

also you have use carbon class:

Carbon\Carbon::now()

this is an example:

  $data = array("name" => $name,"address" => $address,"created_at"=> Carbon::now(),"updated_at"=> now());
DB::table('student')->insert($data);


Answered By - a bcd
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing