How to create a string using date, number and string?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Quincyhazz
User
Posts: 28

How to create a string using date, number and string?

Post by Quincyhazz »

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.


Webmaster
User
Posts: 9430

Post by Webmaster »

$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.


Quincyhazz
User
Posts: 28

Post by Quincyhazz »

$var = date_format(date_create($rsnew["DATE_FLD"]),"Ymd") solved the problem. Thank you for pointing me int right direction.


Post Reply