Welcome Guest, Not a member yet? Register   Sign In
Regular Expressions and GMail. A little help appreciated. [SOLVED]
#1

[eluser]codelearn[/eluser]
Hey all,

Just wanted to preface the question with a Thank You. Just realized today how unique this community is with helping out those of us who aren't programming experts. I have a business to run [which I also program for], so this help is invaluable.

Anyways, question:

I am using the GMail IMAP system to pipe in emails from accounts. GMail passes the date of an email in this format:

Quote:Thu, 18 Dec 2008 13:44:56 -0500

I would like to be able to get the date to look like this:

Quote:Dec. 18th

What is the best way to go about this? Regex? I am AWFUL at it. A PHP date function? I couldn't get it to work.

Thanks a LOT for the help.

Boris
#2

[eluser]Hugh Fletcher[/eluser]
I would use strtotime() inside date() like this...

Code:
date('M jS', strtotime('Thu, 18 Dec 2008 13:44:56 -0500'))
#3

[eluser]richthegeek[/eluser]
just as a solution using regular expressions, mostly because I need to practice my regexs, heres an attempt:
Code:
/([0-3]?[0-9]) ([A-Z][a-z]{2,3})/

Use this with preg_match and fire away!




Theme © iAndrew 2016 - Forum software by © MyBB