Tag:Time function

  • Application introduction of Perl Localtime function

    Time:2022-5-2

    1. General use: @nowtime=localtime(); #($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();be careful: $mon+1,$year+1900; $now_string = localtime;  # e.g., “Thu Oct 13 04:54:34 1994” 2. If you want to save the time in the database, you can first save it as a string, and then process the string when reading it. @nowtime=localtime(); $nowstring=join(‘,’,@nowtime);Save $nowstring;Read: @nowtime=split(‘,’,$nowstring); For more information, please refer […]

  • PHP time related common function usage examples

    Time:2020-8-21

    This paper describes the common usage of PHP time related functions. For your reference, the details are as follows: <?php /** *Set time zone */ date_default_timezone_set(“Asia/Shanghai”); /** *Get time zone */ echo date_default_timezone_get(); //Results UTC echo “<br/>”; /** *Add time */ $date=date_ Create (“2013-03-15”); // create a datetime object date_add($date,date_interval_create_from_date_string(“40 month”));//years days //date_ interval_ create_ […]

  • On the improvement of language conversion of timeago field in laravel project

    Time:2020-8-13

    In our past larravel projects, time was often used_ There are many ways to implement such fields as ago and convert them into the local language we are familiar with, such as writing a time_ The auxiliary function of ago converts it to local, or uses carbon‘sdiffForHumansThe function is then replaced with the local language […]

  • On the improvement method of timeago field language transformation in laravel project

    Time:2019-11-2

    In our past laravel projects, we often need to use fields such as time Gu ago, and convert them to our familiar local language. There are many ways to achieve this, such as writing a time Gu ago auxiliary function to convert it to local, or using carbondiffForHumansThe function is then replaced with the local […]

  • Introduction to the Application of Perl Localtime Time Function

    Time:2019-9-1

    1. General use: @nowtime=localtime();#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();Be careful:$mon+1,$year+1900;$now_string = localtime;  # e.g., “Thu Oct 13 04:54:34 1994” 2. If you want to save time in the database, you can save it as a string first, and then read the string before processing. @nowtime=localtime();$nowstring=join(‘,’,@nowtime);Save $nowstring;Read:@nowtime=split(‘,’,$nowstring); For more information, see http://perldoc.perl.org/functions/localtime.html