luminous Posted October 6, 2010 Share Posted October 6, 2010 I'm setting a date using: $day = date("d")+1; However when I echo this result I get a single character rather than two i.e '7' and not '07', anyone know what could be up with this? I'm sure it's something to do with the '+1' because i create the current date with this code and returns with the format I want. Thanks! Link to comment https://forums.phpfreaks.com/topic/215282-dated1-misses-trailing-0/ Share on other sites More sharing options...
BlueSkyIS Posted October 6, 2010 Share Posted October 6, 2010 the result of performing regular math would not zero-pad the result. php is being "nice" by not complaining about using a zero-padded number in a math equation. if you want the zero back, you'll need to add it using str_pad() or use number formatting. Link to comment https://forums.phpfreaks.com/topic/215282-dated1-misses-trailing-0/#findComment-1119609 Share on other sites More sharing options...
luminous Posted October 6, 2010 Author Share Posted October 6, 2010 thankyou! Link to comment https://forums.phpfreaks.com/topic/215282-dated1-misses-trailing-0/#findComment-1119611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.