Given a string like:
Sun Feb 06 2011 12:49:55 GMT-0800 (PST)
How can you convert that to:
Feb 6
And / Or
Sun Jan 26 2011 12:49:55 GMT-0800 (PST)
to: Jan 26
Any ideas?
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.
There aren’t any built-in formatting functions to use here, you just have to use the Date methods to build the string:
Or, if that string will always stay in that format, you can simply extract the relevant parts without converting it to a date object first: