簡體   English   中英

如何生成特定日期,例如 3 月 13 日

[英]How do I generate a specific date such as the 13th of March

我一直在使用以下代碼來生成日期。

$datejoined = strip_tags(date('Y-m-d H:i:s', strtotime("+1 day")));

我如何生成 4 月 13 日的特定日期?

strtotime()可以從幾乎任何文本行生成日期日期。 strtotime('April 13')在今年的 4 月 13 日是可以的。 使用以下代碼行對其進行測試:

  print date('Y-m-d H:i:s', strtotime('April 13'));

但我個人建議你使用更快的函數mktime()

mktime(0, 0, 0, 4, 13); // 0:00:00, 4th month, 13 day, [current year].

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM