jwk811 Posted January 5, 2007 Share Posted January 5, 2007 how can i change a four digit number like the year 2006 into a two digit number with the last two digits remaining like 06? Quote Link to comment Share on other sites More sharing options...
fert Posted January 5, 2007 Share Posted January 5, 2007 [code]$last=$year{2}.$year{3};[/code] Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 5, 2007 Share Posted January 5, 2007 Is there more to this question than meets the eye?Ken Quote Link to comment Share on other sites More sharing options...
jwk811 Posted January 5, 2007 Author Share Posted January 5, 2007 how about getting the last two digits in a sentence.. because i just relized that i store the date like this: January 14, 2006. How could I make it so it gets just the last two without knowing how many are in the string? Would I have to do a string count and subtract the difference? if thats the way to do it could you help me with that? im not too sure on how to do that either.. thanks! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 5, 2007 Share Posted January 5, 2007 If you are storing the date in a database, you really should be storing it as a "date" type field. Tell us what you're using to format the date now.If you store it as a "date" field, you can always display it however you want.Ken Quote Link to comment Share on other sites More sharing options...
jwk811 Posted January 5, 2007 Author Share Posted January 5, 2007 nevermind forget about that part i got it.. i process it before it enters the data base and its separated then.. so i got that thanks.. that seems like a better idea to use a date row instead.. how could i put it into the db when in parts like there will be a select form for the month day and month how can you combine it to fit into the db in the date row? and how could i take it out so its set up like January 14, 2006? thanks for you help! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 5, 2007 Share Posted January 5, 2007 Look at the [url=http://www.php.net/strtotime]strtotime()[/url] and [url=http://www.php.net/date]date()[/url] functions.Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.