开发者

PHP getting time by time format

开发者 https://www.devze.com 2023-02-27 08:28 出处:网络
I have 2 strings: 1. \"%Y%d%m-text.TXT\" 2. \"20112104-text.TX开发者_开发问答T\" How can I get \"20112104\" using selected format? I can have in the first string format \"%d%d%d\", and my output

I have 2 strings:

 1. "%Y%d%m-text.TXT"
 2. "20112104-text.TX开发者_开发问答T"

How can I get "20112104" using selected format? I can have in the first string format "%d%d%d", and my output should be "212121". Thank you in advance.


Is this what you are looking for?

$sFile = "%s-text.TXT";
$sFile = sprintf($sFile, date("Ydm"));

If not, please add more context.

0

精彩评论

暂无评论...
验证码 换一张
取 消