PHP:将一年中的某一天转换为月份和月份中的某一天
问题描述:
如果你有一年中的一天.你怎么能把它转换成月份和月份的日期?例如:144"日应转换为 5 月 26 日.我想我还必须添加实际年份来解释闰年.但我什么也没找到.
If you have the day of the year. How can you convert that to day of month and month? For example: The day "144" should be converted to 26th of May. I guess I also have to add the actual year to account for leap years. But I haven't found anything at all.
例如函数 mktime() 期望月、年和日月.
For example the function mktime() exepects the month, year and day of month.
大家有什么建议吗?
答
strtotime("January 1st +".($days-1)." days");
这将返回对应于一年中指定日期的时间戳.
This will return a timestamp corresponding to the specified day of the year.