为什么使用以下代码时,以下日期(无论年份如何)给出 1970-01-01:
echo date('Y-m-d',strtotime('25/12/2000'))
.
PHP 版本 7.0.21
Array
(
[0] => 13/01/2000
[1] => 14/01/2000
[2] => 15/01/2000
[3] => 16/01/2000
[4] => 17/01/2000
[5] => 18/01/2000
[6] => 19/01/2000
[7] => 20/01/2000
[8] => 21/01/2000
[9] => 22/01/2000
[10] => 23/01/2000
[11] => 24/01/2000
[12] => 25/01/2000
[13] => 26/01/2000
[14] => 27/01/2000
[15] => 28/01/2000
[16] => 29/01/2000
[17] => 30/01/2000
[18] => 31/01/2000
[19] => 13/02/2000
[20] => 14/02/2000
[21] => 15/02/2000
[22] => 16/02/2000
[23] => 17/02/2000
[24] => 18/02/2000
[25] => 19/02/2000
[26] => 20/02/2000
[27] => 21/02/2000
[28] => 22/02/2000
[29] => 23/02/2000
[30] => 24/02/2000
[31] => 25/02/2000
[32] => 26/02/2000
[33] => 27/02/2000
[34] => 28/02/2000
[35] => 29/02/2000
[36] => 30/02/2000
[37] => 31/02/2000
[38] => 13/03/2000
[39] => 14/03/2000
[40] => 15/03/2000
[41] => 16/03/2000
[42] => 17/03/2000
[43] => 18/03/2000
[44] => 19/03/2000
[45] => 20/03/2000
[46] => 21/03/2000
[47] => 22/03/2000
[48] => 23/03/2000
[49] => 24/03/2000
[50] => 25/03/2000
[51] => 26/03/2000
[52] => 27/03/2000
[53] => 28/03/2000
[54] => 29/03/2000
[55] => 30/03/2000
[56] => 31/03/2000
[57] => 13/04/2000
[58] => 14/04/2000
[59] => 15/04/2000
[60] => 16/04/2000
[61] => 17/04/2000
[62] => 18/04/2000
[63] => 19/04/2000
[64] => 20/04/2000
[65] => 21/04/2000
[66] => 22/04/2000
[67] => 23/04/2000
[68] => 24/04/2000
[69] => 25/04/2000
[70] => 26/04/2000
[71] => 27/04/2000
[72] => 28/04/2000
[73] => 29/04/2000
[74] => 30/04/2000
[75] => 31/04/2000
[76] => 13/05/2000
[77] => 14/05/2000
[78] => 15/05/2000
[79] => 16/05/2000
[80] => 17/05/2000
[81] => 18/05/2000
[82] => 19/05/2000
[83] => 20/05/2000
[84] => 21/05/2000
[85] => 22/05/2000
[86] => 23/05/2000
[87] => 24/05/2000
[88] => 25/05/2000
[89] => 26/05/2000
[90] => 27/05/2000
[91] => 28/05/2000
[92] => 29/05/2000
[93] => 30/05/2000
[94] => 31/05/2000
[95] => 13/06/2000
[96] => 14/06/2000
[97] => 15/06/2000
[98] => 16/06/2000
[99] => 17/06/2000
[100] => 18/06/2000
[101] => 19/06/2000
[102] => 20/06/2000
[103] => 21/06/2000
[104] => 22/06/2000
[105] => 23/06/2000
[106] => 24/06/2000
[107] => 25/06/2000
[108] => 26/06/2000
[109] => 27/06/2000
[110] => 28/06/2000
[111] => 29/06/2000
[112] => 30/06/2000
[113] => 31/06/2000
[114] => 13/07/2000
[115] => 14/07/2000
[116] => 15/07/2000
[117] => 16/07/2000
[118] => 17/07/2000
[119] => 18/07/2000
[120] => 19/07/2000
[121] => 20/07/2000
[122] => 21/07/2000
[123] => 22/07/2000
[124] => 23/07/2000
[125] => 24/07/2000
[126] => 25/07/2000
[127] => 26/07/2000
[128] => 27/07/2000
[129] => 28/07/2000
[130] => 29/07/2000
[131] => 30/07/2000
[132] => 31/07/2000
[133] => 13/08/2000
[134] => 14/08/2000
[135] => 15/08/2000
[136] => 16/08/2000
[137] => 17/08/2000
[138] => 18/08/2000
[139] => 19/08/2000
[140] => 20/08/2000
[141] => 21/08/2000
[142] => 22/08/2000
[143] => 23/08/2000
[144] => 24/08/2000
[145] => 25/08/2000
[146] => 26/08/2000
[147] => 27/08/2000
[148] => 28/08/2000
[149] => 29/08/2000
[150] => 30/08/2000
[151] => 31/08/2000
[152] => 13/09/2000
[153] => 14/09/2000
[154] => 15/09/2000
[155] => 16/09/2000
[156] => 17/09/2000
[157] => 18/09/2000
[158] => 19/09/2000
[159] => 20/09/2000
[160] => 21/09/2000
[161] => 22/09/2000
[162] => 23/09/2000
[163] => 24/09/2000
[164] => 25/09/2000
[165] => 26/09/2000
[166] => 27/09/2000
[167] => 28/09/2000
[168] => 29/09/2000
[169] => 30/09/2000
[170] => 31/09/2000
[171] => 13/10/2000
[172] => 14/10/2000
[173] => 15/10/2000
[174] => 16/10/2000
[175] => 17/10/2000
[176] => 18/10/2000
[177] => 19/10/2000
[178] => 20/10/2000
[179] => 21/10/2000
[180] => 22/10/2000
[181] => 23/10/2000
[182] => 24/10/2000
[183] => 25/10/2000
[184] => 26/10/2000
[185] => 27/10/2000
[186] => 28/10/2000
[187] => 29/10/2000
[188] => 30/10/2000
[189] => 31/10/2000
[190] => 13/11/2000
[191] => 14/11/2000
[192] => 15/11/2000
[193] => 16/11/2000
[194] => 17/11/2000
[195] => 18/11/2000
[196] => 19/11/2000
[197] => 20/11/2000
[198] => 21/11/2000
[199] => 22/11/2000
[200] => 23/11/2000
[201] => 24/11/2000
[202] => 25/11/2000
[203] => 26/11/2000
[204] => 27/11/2000
[205] => 28/11/2000
[206] => 29/11/2000
[207] => 30/11/2000
[208] => 31/11/2000
[209] => 13/12/2000
[210] => 14/12/2000
[211] => 15/12/2000
[212] => 16/12/2000
[213] => 17/12/2000
[214] => 18/12/2000
[215] => 19/12/2000
[216] => 20/12/2000
[217] => 21/12/2000
[218] => 22/12/2000
[219] => 23/12/2000
[220] => 24/12/2000
[221] => 25/12/2000
[222] => 26/12/2000
[223] => 27/12/2000
[224] => 28/12/2000
[225] => 29/12/2000
[226] => 30/12/2000
[227] => 31/12/2000
)
> strtotime 不接受您提供的格式使用日期时间,这是为此
$dt = new DateTime::createFromFormat('d/m/Y','25/12/2000');
echo $dt->format('Y-m-d');
尝试使用"-"而不是"/"
2000/31/12 至 2000/31/12