我希望将这行代码转换为PHP的mktime():
Calendar timeStartPoint = Calendar.getInstance();
timeStartPoint.set(11, 0);
timeStartPoint.set(12, 0);
timeStartPoint.set(13, 0);
timeStartPoint.set(14, 0);
timeStartPoint.set(5, monthStartPoint ? 1 : 5);
timeStartPoint.set(2, 0);
timeStartPoint.set(1, 2004);
我想1是年,5是某种类型的月份,其余的我不确定。我在网上四处查看并设法找到java.util.calendar.set(x,x)的文档,但是没有一个列出了恶魔整数名称。
答案 0 :(得分:4)
常数的含义如下:
Calendar timeStartPoint = Calendar.getInstance();
timeStartPoint.set(11, 0); // hour of day
timeStartPoint.set(12, 0); // minute
timeStartPoint.set(13, 0); // second
timeStartPoint.set(14, 0); // millisecond
timeStartPoint.set(5, monthStartPoint ? 1 : 5); // day of month
timeStartPoint.set(2, 0); // month (zero-based!)
timeStartPoint.set(1, 2004); // year
我不熟悉PHP,但这应该与
相对应$timeStartPoint = mktime(0, 0, 0, 1, ($monthStartPoint ? 1 : 5), 2004);
答案 1 :(得分:0)