I am generating a reference number, using jQuery and Php comprising:
a static string, a dynamic letter of the alphabet, the date in Month and Year and an autogenerated id.
I have these four elements concatenated as below.
$("#refno").text("ABC" + str + <?php echo date('Y') ?> + <?php echo date('m')?> + <?php echo $id -> id + 1; ?>);
str is the dynamic letter , set by selecting from a dropdown.
It is required that I output the month in the mm format e.g 09 for September.
Challenge is, the leading zero in the month is truncated in the resulting ref number. e.g
instead of ABCR20120923 i get ABCR2012923 . Yet when I echo date('m') 09 is output.
While I could choose to have an if statement that concatenates a zero onto the single
character months, I would want to understand why zero is truncated and how I can have it
displayed.
Thanks.Help Appreciated.