首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏Web技术布道师

    令人困惑的strtotime

    , 都可能会有这个迷惑, 我们也可以很轻松的验证类似的其他月份, 印证这个结论: var_dump(date("Y-m-d", strtotime("-1 month", strtotime("2017 -03-31"))));//输出2017-03-03var_dump(date("Y-m-d", strtotime("+1 month", strtotime("2017-08-31"))));//输出 (date("Y-m-d", strtotime("last month", strtotime("2017-03-31"))));//输出2017-03-03 那怎么办呢? day of +1 month", strtotime("2017-08-31"))));////输出2017-09-01var_dump(date("Y-m-d", strtotime("first day of next month", strtotime("2017-01-31"))));////输出2017-02-01var_dump(date("Y-m-d", strtotime("last

    75520发布于 2019-07-25
  • 来自专栏luxixing

    强大的strtotime函数

    $t = strtotime("-{$n} days 00:00:00");//当前日期的前n天的0点 $t = strtotime("-{$n} days 23:00:00");//当前日期的前n天的 strtotime("+{$n} days 00:00:00");//当前日期的后n天的0点 $t = strtotime("+{$n} days 23:00:00");//当前日期的后n天的23点 获取指定日期前 $n*86400 s的时间 $t = strtotime("+{$n} days {$data} 00:00:00");//当前日期的后n天的0点 $t = strtotime("+{$n} days "); $t = strtotime("yesterday 00:00:00"); //以上三个结果一样,但是为了严谨期间,如果需要时分秒,给出精确时间 $t = strtotime("tomorrow "); $t = strtotime("tomorrow midnight"); $t = strtotime("tomorrow 00:00:00"); $year = 2015; $month =

    1.2K30发布于 2019-05-28
  • 来自专栏Web技术布道师

    php 之 strtotime 使用需注意

    var_dump(date('Y-m-d')); var_dump(date('Y-m-d', strtotime('- 1 day'))); var_dump(date('Y-m-d', strtotime ('+ 2 day'))); var_dump(date('Y-m-d', strtotime('- 1 week'))); var_dump(date('Y-m-d', strtotime('+ 2 02" string(10) "2018-10-23" 上面的这些都没有问题,毕竟day和week的时间是固定的,但是month就不一样了,有大月和小月 var_dump(date("Y-m-d", strtotime ("-1 month", strtotime("2018-05-31")))); 打印出来的结果是: string(10) "2018-05-01" !!! ("last day of -1 month", strtotime("2018-05-31")))); 打印结果是: string(10) "2017-04-30" 为了避免 strtotime 引起的问题

    64720发布于 2019-07-25
  • 来自专栏陶士涵的菜地

    重回基础(date函数和strtotime函数)

    ():把字符串类型日期格式转成时间戳 使用函数strtotime(),打印前一天日期,参数:String类型 “-1 day” echo date("Y-m-d H:i:s",strtotime("-1day "));输出 2016-05-12 15:27:33 使用函数strtotime(),打印明天日期,参数:String类型 “+1 day” echo date("Y-m-d H:i:s",strtotime s",strtotime("+1 week"));;输出 2016-05-20 15:29:35 使用函数strtotime(),打印下一个月日期,参数:String类型 “+1 month” echo date("Y-m-d H:i:s",strtotime("+1 month")); 输出:2016-06-13 15:37:42 使用函数strtotime(),打印下周一日期,参数:String类型 “last Mondy” echo date("Y-m-d H:i:s",strtotime("next Monday")); 输出:2016-05-16 00:00:00 使用函数strtotime

    64510发布于 2019-09-10
  • 来自专栏Hank’s Blog

    4-6 R语言函数 排序

    #sort:对向量进行排序;返回排好序的内容 #order:返回排好序的内容的下标/多个排序标准 > x <- data.frame(v1=1:5,v2=c(10,7,9,6,8),v3=11:15,v4=c(1,1,2,2,1)) > sort(x$v2) [1] 6 7 8 9 10 > sort(x$v2,decreasing = TRUE) [1] 10 9 8 7 6 > order(x$v2) [1] 4 2 5 3 1 > x[order(x$v2),] v1 v

    38940发布于 2020-09-16
  • 来自专栏zcqshine's blog

    PHP里 date() 函数与 strtotime() 函数笔记

    ###获取今日0点的时间戳 $today = strtotime(date('Ymd')); $today2 = strtotime('today'); echo "today = ". $today2; 输出: today = 1463500800 today2 = 1463500800 由此可见,获取今日0点时的时间戳可以直接使用strtotime("today").

    1.3K60发布于 2018-05-11
  • 来自专栏yuyy.info技术专栏

    《代码整洁之道》笔记(4-6章节)

    个人认为注释还是要写,算是对代码的中文翻译,因为我们的英语水平,命名习惯各不相同。

    31510编辑于 2022-06-28
  • 来自专栏量子位

    支持移动GPU、推断速度提升4-6

    TensorFlow用于移动设备的框架TensorFlow Lite发布重大更新,支持开发者使用手机等移动设备的GPU来提高模型推断速度。

    1.1K30发布于 2019-04-24
  • 来自专栏codersam

    PHP strtotime(date(Y-m-d) . 00:00:00)获取时间戳不准确的问题

    今天遇到一个BUG,在使用strtotime(date('Y-m-d') . ' 00:00:00') 获取当天零点时间戳会出现不准确的问题,有时候获取的是正常的零点时间戳,有时候获取的是当天8点的时间戳 解决方案: strtotime(date('Y-m-d')) // 获取当天零点时间戳 strtotime(date('Y-m-d') . ' + 1 day') - 1 // 获取当天23点59分59 秒时间戳 strtotime(date('Y-m-d')) - 1 // 获取昨天23点59分59秒时间戳

    3.1K20发布于 2019-12-17
  • 来自专栏人人都是极客

    支持移动GPU、推断速度提升4-6

    虽然移动设备的处理能力和功率都有限。虽然TensorFlow Lite提供了不少的加速途径,比如将机器学习模型转换成定点模型,但总是会在模型的性能或精度上做出让步。

    1.7K20发布于 2019-03-15
  • 来自专栏人工智能与演化计算成长与进阶

    15非监督学习异常检测4-6构建与评价异常检测系统

    Note 对于异常检测问题而言,样本数据集往往是倾斜的,即 标记为 1 异常的数据往往很少,而标记为 0 即正常的数据往往很多 此时使用准确率等方法来进行判断一个模型的好坏往往是不合适的,所以通过 查准率和查全率以及 F1 分数能够很好的分析和判断这个问题

    1.8K11发布于 2020-08-14
  • 来自专栏AI机器学习与深度学习算法

    机器学习入门 4-6 网格搜索与k近邻算法中更多超参数

    本系列是《玩转机器学习教程》一个整理的视频笔记。本小节主要介绍使用sklearn网格搜索寻找最好的超参数以及kNN计算两个数据点距离的其他距离定义。

    80900发布于 2019-11-13
  • 来自专栏仙士可博客

    计算在工作日时间推迟时间的算法

        {         foreach ($this->holidayDay as $startDate => $endDate) {             $this->holidayData[strtotime ($startDate)] = strtotime($endDate);         }         ksort($this->holidayData);         foreach ($this ->holidayExtraWorkDay as $startDate => $endDate) {             $this->workDayData [strtotime($startDate )     {         //判断当日是否为上班日         $isWorkDay = $this->checkIsWorkDay($datetime);         $time = strtotime $startTime)] = strtotime($date . " " . 

    1.3K30编辑于 2022-09-13
  • 来自专栏desperate633

    4-6课 数据的过滤where子句操作符使用通配符进行过滤

    实际查询中,通常不会检索所有行,需要对数据进行筛选过滤,选出符合我们需要条件的数据。

    2.1K10发布于 2018-08-22
  • 来自专栏老高的技术博客

    PHP时间函数总结

    注意年月日的顺序 echo date('Y-m-d', strtotime("06/08/2014")), "\n"; //2014-06-08 echo date('Y-m-d', strtotime echo strtotime("2014-03-27"), "\n"; echo strtotime("December 31"), "\n"; echo strtotime("now"), "\n"; echo strtotime("10 September 2000"), "\n"; echo strtotime("+1 day"), "\n"; echo strtotime("+1 week") strtotime("next Thursday"), "\n"; echo strtotime("last Monday"), "\n"; 还可以指定日期 $time = date('Y-m-d H :i:s', time()); echo strtotime($time.'1day'), "\n"; echo "\n"; echo strtotime($time

    3.4K20编辑于 2022-12-27
  • 来自专栏WordPress果酱

    告别相差8小时问题,在 WordPress 正确使用 Date 和 Time

    wpjam_strtotime 前面解决了在 WordPress 中基于时间戳正确显示时间的问题,然后还有一个常见的操作就是将日期转换为日期戳,PHP 提供了一个 strtotime 的函数: echo 所以为了方便将当地时间正确转换成时间戳,所以我写了一个函数 wpjam_strtotime: function wpjam_strtotime($string){ return date_create ("2022-11-21 23:15:45"); // 1669043745 wpjam_strtotime 很快会在 WPJAM Basic 新版本中发布,所以有了第二条规则:在 WordPress 进行日期和时间转换成时间戳操作的时候,把 strtotime 函数替换成 wpjam_strtotime 函数即可。 将日期和时间转换成时间戳的时候:把 strtotime 函数替换成 wpjam_strtotime 函数。

    1.7K30编辑于 2023-04-13
  • 来自专栏yuyy.info技术专栏

    《Go语言精进之路:从新手到高手的编程思想、方法和技巧1》4-6章笔记

    醍醐灌顶到没有,别扭确实存在。当然这需要一段时间来适应,说下这段时间最难接受的点吧。 1、文件的单一职责做不好,一个文件里有多个结构体,想知道某个结构体有哪些方法,需要借助IDE 2、命名使用单字母,特定场景能理解,例如循环里的i,遍历map的k,v,但是很多单字母不是这种常见场景里的。代码整洁之道里说命名要见名知意,宁愿用长命名也不用无法表达清楚的短命名,这点go背道而驰。此书里说有时需要短命名加注释,而代码整洁之道里说注释就不应该存在,如果要用注释,说明写的代码无法准确清晰的表达意思。

    1.2K20编辑于 2022-09-21
  • 来自专栏全栈程序员必看

    计算一段日期内的周末天数(星期六,星期日总和)(

    id=343578′ scrolling=’no’>function get_weekend_days($start_date,$end_date){ if (strtotime($start_date ) > strtotime($end_date)) list($start_date, $end_date) = array($end_date, $start_date); $start_reduce = $end_add = 0; $start_N = date(‘N’,strtotime($start_date)); $start_reduce = ($start_N == 7) ? 1 : 0; $end_N = date(‘N’,strtotime($end_date)); in_array($end_N,array(6,7)) && $end_add = ($end_N = 2 : 1; $days = abs(strtotime($end_date) – strtotime($start_date))/86400 + 1; return floor(($days +

    1.8K20编辑于 2022-09-07
  • 获取每天时间戳,每周时间戳,每月时间戳和每年时间戳

    59', strtotime("$startstr +6 day"))); $Monthend = strtotime(date('Y-m-d 23:59:59', strtotime("$startstr day'))); $backDays[$i]['end']=strtotime(date("Y-m-d 23:59:59",strtotime('-'.$i.' ]['end'] = strtotime($year 59', strtotime("$startstr +6 day"))); $Monthend = strtotime(date('Y-m-d 23:59:59', strtotime("$startstr 'week_end'] = strtotime($year

    6K10编辑于 2024-08-16
  • 来自专栏Lansonli技术博客

    PHP获取今天,昨天,本月,上个月,本年 起始时间戳

    "m") - ($month - 1), 0, date("Y"))); // 以下方法有误差,例如3月31日那天的上个月时间匹配出是3月2日,已亲自测试,所以已废弃 //$begin_time = strtotime (date('Y-m-01 00:00:00',strtotime('-1 month'))); //$end_time = strtotime(date("Y-m-d 23:59:59", strtotime day'))); $begin_year = strtotime(date("Y",time())."-1". "-1"); //本年开始 $end_year = strtotime(date("Y",time())."-12". "-31"); //本年结束 //现在的时间到第二天凌晨相差的时间戳 $time = (strtotime(date('Y-m-d'))+3600*24) - time() ;

    2.1K20发布于 2021-10-09
领券