I am trying to create a string variable that has the following format - $var = date_format($rsnew["DATE_FLD"],"Ymd") . $numbervar . $stringvar but $var only stores $numbervar . $stringvar. for example, I wish to output $var = 20190621001a2b12f instead I get $var=001a2b12f. Your assistance is be greatly appreciated. The date portion is missing.
How to create a string using date, number and string?
-
- User
- Posts: 9432
$rsnew["DATE_FLD"] is string, not date, you need to convert it to date first, see example in https://www.php.net/manual/en/datetime.format.php.
-
- User
- Posts: 28
$var = date_format(date_create($rsnew["DATE_FLD"]),"Ymd") solved the problem. Thank you for pointing me int right direction.