简体   繁体   English

在PHP 5.5中以月为单位使用DateTime的最大限制

[英]Maximum limit for using ordinal units in month for DateTime in PHP 5.5

I was reading this 我在读这个

and I am not sure if twelfth is the maximum for ordinal values. 并且我不确定twelfth是否是序数值的最大值。

The reason is I want to do something like 原因是我想做类似的事情

$startDate = new \\DateTime('twenty-third day of this month');

and I am not sure what's the maximum limit for the ordinal value for the day part of the month. 而且我不确定该月的一天中的序数值的最大限制是多少。

As of php 7.0.4 twelfth is the "largest" ordinal supported: php 7.0.4起, twelfth受支持的“最大”顺序是:

/* The relative text table. */
static timelib_lookup_table const timelib_reltext_lookup[] = {
    { "first",    0,  1 },
    { "next",     0,  1 },
    { "second",   0,  2 },
    { "third",    0,  3 },
    { "fourth",   0,  4 },
    { "fifth",    0,  5 },
    { "sixth",    0,  6 },
    { "seventh",  0,  7 },
    { "eight",    0,  8 },
    { "eighth",   0,  8 },
    { "ninth",    0,  9 },
    { "tenth",    0, 10 },
    { "eleventh", 0, 11 },
    { "twelfth",  0, 12 },
    { "last",     0, -1 },
    { "previous", 0, -1 },
    { "this",     1,  0 },
    { NULL,       1,  0 }
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM