Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel 5.8迁移:列类型时间(格式hh:mm)_Php_Laravel_Laravel 5 - Fatal编程技术网

Php Laravel 5.8迁移:列类型时间(格式hh:mm)

Php Laravel 5.8迁移:列类型时间(格式hh:mm),php,laravel,laravel-5,Php,Laravel,Laravel 5,我是拉拉维尔的初学者。我有我的项目在拉威尔5.8 这是我的架构文件: Schema::create('users', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name', 120)->nullable(); $table->string('surname', 120)->nullable

我是拉拉维尔的初学者。我有我的项目在拉威尔5.8

这是我的架构文件:

Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name', 120)->nullable();
            $table->string('surname', 120)->nullable();
            $table->string('email', 120)->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->time('v_day1a')->default('00:00');
            $table->time('v_day1b')->default('00:00');
            $table->time('v_day2a')->default('00:00');
            $table->time('v_day2b')->default('00:00');
            $table->dateTime('last_activity')->nullable();
            $table->rememberToken();
            $table->timestamps();
            $table->engine = "InnoDB";
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
在v_day1a、v_day1b、v_day2a、v_day2b的数据库中,我有以下时间格式:00:00:00。我需要把这个改成00:00(hh:mm)


我该怎么做?

是的,我有mysql:)没关系,我后来看到InnoDB:)如果是mysql数据库,那么类型时间列的格式是'HH:MM:ss',所以你不能将默认设置为00:00,只使用默认的00:00:00。此外,当您稍后在此列中保存时间时,请使用此格式。要在以后只读取时间而不读取秒数,可以使用
格式('H:i')
。在这种情况下,我如何设置格式HH:MM?在MySQL中,有'HH:MM:ss'格式(或'hhh:MM:ss'表示大小时),您不能只去掉秒数,它是类型的一部分。但与@CodyKL建议的不同,您可以使用
HH:MM
格式设置该值,因为MySQL会这样对待它。你可以阅读我链接的文档来了解MySQL是如何处理时间列的。是的,我有MySQL:)没关系,我后来看到InnoDB:)如果它是MySQL数据库,那么类型时间列的格式是'HH:MM:ss',所以你不能将默认值设置为00:00,只使用默认值00:00:00。此外,当您稍后在此列中保存时间时,请使用此格式。要在以后只读取时间而不读取秒数,可以使用
格式('H:i')
。在这种情况下,我如何设置格式HH:MM?在MySQL中,有'HH:MM:ss'格式(或'hhh:MM:ss'表示大小时),您不能只去掉秒数,它是类型的一部分。但与@CodyKL建议的不同,您可以使用
HH:MM
格式设置该值,因为MySQL会这样对待它。您可以阅读我链接的文档,了解MySQL如何处理时间列。