PHP Programming

Converting MySQL dateTime to RFC-822 (RSS pubDate) in PHP

I had the need to convert a MySQL datetime time stamp into a format accepted by the RSS 2.0 specification. To get the first part, you can do a SQL query like the following:

SELECT DATE_FORMAT(dateTimeColumn, '%a, %d %b %Y %T') AS rssPubDate FROM yourTable

After that, you need to get the timezone, which can be accomplished by using this:

$timeZone = date('T');

So lets say you store the rssPubDate from MySQL in a variable called $rssPubDate, all you need to do is $rssPubDate .= ” {$timeZone}”;

That’s it! You now have a RFC-822 compliant time stamp.


Unobtrusive Subversion

Sometimes you enter a development environment that just isn’t going to work well with version control software.  Maybe they don’t want to use version control software, or maybe the way their infrastructure is set up makes it hard to do.
I currently work at such a place, so I came up with a way to use Subversion for the vast majority of projects that I work on.
Note:  This method works only if you have full ownership over a project.  Any other people working on it would have their changes overwritten.

If I have full ownership over a project, I do the following.
1) Import the project of relevant subdirectory into a new Subversion repository.
2) Make my edits locally, committing whenever I feel inclined.
3) When it’s time to update on the server, I do an “svn export” of the project, and then Rsync it with the server.
It’s not ideal situation, but it works well for now.