I have a date string that I need to simplify in Ruby:
2008-10-09 20:30:40
I only want the day portion:
2008-10-09
I’m looking for a gsub line that will strip everything after a set number of characters or the first whitespace.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I prefer to use as simple a solution as I can. Using
gsubis needlessly complex. Either of these will do it: