<tfoot id='vOJGb'></tfoot>

  • <legend id='vOJGb'><style id='vOJGb'><dir id='vOJGb'><q id='vOJGb'></q></dir></style></legend>

    1. <small id='vOJGb'></small><noframes id='vOJGb'>

      <i id='vOJGb'><tr id='vOJGb'><dt id='vOJGb'><q id='vOJGb'><span id='vOJGb'><b id='vOJGb'><form id='vOJGb'><ins id='vOJGb'></ins><ul id='vOJGb'></ul><sub id='vOJGb'></sub></form><legend id='vOJGb'></legend><bdo id='vOJGb'><pre id='vOJGb'><center id='vOJGb'></center></pre></bdo></b><th id='vOJGb'></th></span></q></dt></tr></i><div id='vOJGb'><tfoot id='vOJGb'></tfoot><dl id='vOJGb'><fieldset id='vOJGb'></fieldset></dl></div>
        <bdo id='vOJGb'></bdo><ul id='vOJGb'></ul>
      1. 将碳日期转换为 mysql 时间戳.

        Converting a carbon date to mysql timestamp.(将碳日期转换为 mysql 时间戳.)
          <tbody id='dYlcf'></tbody>
        <i id='dYlcf'><tr id='dYlcf'><dt id='dYlcf'><q id='dYlcf'><span id='dYlcf'><b id='dYlcf'><form id='dYlcf'><ins id='dYlcf'></ins><ul id='dYlcf'></ul><sub id='dYlcf'></sub></form><legend id='dYlcf'></legend><bdo id='dYlcf'><pre id='dYlcf'><center id='dYlcf'></center></pre></bdo></b><th id='dYlcf'></th></span></q></dt></tr></i><div id='dYlcf'><tfoot id='dYlcf'></tfoot><dl id='dYlcf'><fieldset id='dYlcf'></fieldset></dl></div>
      2. <small id='dYlcf'></small><noframes id='dYlcf'>

          <legend id='dYlcf'><style id='dYlcf'><dir id='dYlcf'><q id='dYlcf'></q></dir></style></legend>

            • <tfoot id='dYlcf'></tfoot>

                  <bdo id='dYlcf'></bdo><ul id='dYlcf'></ul>
                  本文介绍了将碳日期转换为 mysql 时间戳.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 mysql 数据库中有一个时间戳变量列.试图将碳时间戳转换为我可以在那里输入的东西,但 Carbon::now() 只返回一个碳对象,当我尝试使用碳对象的时间戳字符串时,它不会在mysql中注册.

                  I have a timestamp variable column in a mysql database. Trying to convert a carbon timestamp to something that I can input there, but Carbon::now() only returns a Carbon object and when I try to use the timestamp string of the Carbon object, it does not register in mysql.

                  public function store(CreateArticleRequest $request){
                          $input = $request->all(); 
                          var_dump($input); // JUST SO YOU CAN SEE
                          $input['published_at'] = Carbon::now(); 
                          var_dump($input); // JUST SO YOU CAN SEE
                          Article::create($input);   
                  }
                  

                  我的第一个 var 转储是这样的:

                  My first var dump is like so:

                  array (size=4)
                    '_token' => string 'Wy67a4hWxrnfiGz61wmXfYCSjAdldv26wOJiLWNc' (length=40)
                    'title' => string 'ASDFasdf' (length=8)
                    'body' => string 'asdfasdf' (length=8)
                    'published_at' => string '2015-08-26' (length=10)  
                  

                  我的第二个 var 转储是这样的.

                  My second var dump is like so.

                  与published_at"相关的 mysql 列是一个时间戳变量.我想如何将其从碳对象转换?

                  The mysql column relating to "published_at" is a timestamp variable. How an I suppose to convert this from a Carbon Object?

                  提前致谢.

                  推荐答案

                  你也可以在你的模型上设置 Mutator.

                  You can also set Mutator on your model.

                  public function setPublishedAt($value)
                  {
                      $this->attributes['published_at'] = strtotime($value);
                  }
                  

                  转换为时间戳

                  $model -> setPublishedAt('2015-08-26'); // 1440572400
                  

                  或者您可以使用 strtotime

                  strtotime — 将任何英文文本日期时间描述解析为 Unix 时间戳

                  strtotime — Parse about any English textual datetime description into a Unix timestamp

                  希望对您有所帮助.

                  这篇关于将碳日期转换为 mysql 时间戳.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <legend id='hGy79'><style id='hGy79'><dir id='hGy79'><q id='hGy79'></q></dir></style></legend>
                    <tfoot id='hGy79'></tfoot>

                      <tbody id='hGy79'></tbody>

                      • <i id='hGy79'><tr id='hGy79'><dt id='hGy79'><q id='hGy79'><span id='hGy79'><b id='hGy79'><form id='hGy79'><ins id='hGy79'></ins><ul id='hGy79'></ul><sub id='hGy79'></sub></form><legend id='hGy79'></legend><bdo id='hGy79'><pre id='hGy79'><center id='hGy79'></center></pre></bdo></b><th id='hGy79'></th></span></q></dt></tr></i><div id='hGy79'><tfoot id='hGy79'></tfoot><dl id='hGy79'><fieldset id='hGy79'></fieldset></dl></div>

                        <small id='hGy79'></small><noframes id='hGy79'>

                            <bdo id='hGy79'></bdo><ul id='hGy79'></ul>