Add text between date and time - PHP

前端 未结 5 1508
我在风中等你
我在风中等你 2020-12-09 18:07

Is it possible to add text between date and time in PHP ?



This will create (07-06-2014 00:00)

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-09 18:45

    Strangely enough I wanted to put

    date("l the jS F Y");

    to read e.g. Monday the 9th January 2017 but instead I got "Monday 3106UTC 9th January 2017". I read the answer above from xception and changed this to date("l \t\h\e jS F Y"), which gave me "Monday h 9th January 2017", so I read the comment from rybo111 and changed this to date("l \t\\h\\e jS F Y") and it still didn't work as I now got "Monday he 9th January 2017".

    After a bit of head scratching I worked out that if letters in the word also form part of the date() function, for example t = Number of days in the given month, these need to be double escaped, otherwise a single escape will suffice. Hence why "at" needs to be coded \a\\t and "the" as \\t\\h\\e.

提交回复
热议问题