phppaper Posted June 16, 2008 Share Posted June 16, 2008 I have a variable: $adate = '16-06-2008' I want to have a variable $temp = 16062008 What function should I use to get $adate which is '16-06-2008' but exclude the "-" sign inside?? Thanks! Link to comment https://forums.phpfreaks.com/topic/110379-get-string/ Share on other sites More sharing options...
vbnullchar Posted June 16, 2008 Share Posted June 16, 2008 echo str_replace('-','',$adate); Link to comment https://forums.phpfreaks.com/topic/110379-get-string/#findComment-566302 Share on other sites More sharing options...
phppaper Posted June 16, 2008 Author Share Posted June 16, 2008 thanks!! Link to comment https://forums.phpfreaks.com/topic/110379-get-string/#findComment-566311 Share on other sites More sharing options...
PFMaBiSmAd Posted June 16, 2008 Share Posted June 16, 2008 That format for a date has very limited use in programming. You cannot sort it or do any greater-than/less-than comparisons. What are you using this for? Link to comment https://forums.phpfreaks.com/topic/110379-get-string/#findComment-566547 Share on other sites More sharing options...
phppaper Posted June 17, 2008 Author Share Posted June 17, 2008 I try to put the date with such a format dd-mm-yyyy inside a <span></span> but the "-" character turn out to be funny number, any idea why?? Link to comment https://forums.phpfreaks.com/topic/110379-get-string/#findComment-566987 Share on other sites More sharing options...
DarkWater Posted June 17, 2008 Share Posted June 17, 2008 Please describe a "funny number". If it's prepended by a %, then you must be running urlencode on it or something. Link to comment https://forums.phpfreaks.com/topic/110379-get-string/#findComment-567021 Share on other sites More sharing options...
bluejay002 Posted June 17, 2008 Share Posted June 17, 2008 I try to put the date with such a format dd-mm-yyyy inside a <span></span> but the "-" character turn out to be funny number, any idea why?? well i was wondering how come "-" turn out to be a funny character. how did you ripped that field for it to be funny in any case? Link to comment https://forums.phpfreaks.com/topic/110379-get-string/#findComment-567047 Share on other sites More sharing options...
The Little Guy Posted June 17, 2008 Share Posted June 17, 2008 I would do something like this: $adate = strtotime('16-06-2008'); Link to comment https://forums.phpfreaks.com/topic/110379-get-string/#findComment-567052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.