PHP getting time by time format
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.
精彩评论