Archive for December, 2008

DateTime To String in PHP

I can never remember this and it always results in much googling when using PHP. How to convert a SQL datetime value to human-readable format (ok, everyone but developers-readable, I happen to like the default datetime representation):

/**
*   Converts the likes of '2008-12-22 12:57:32' to 'December 22, 2008, 12:57 pm'
*/
echo date(  "F j, Y, g:i a", strtotime( $datetime_value ) );

See this page for more details on formatting.

1 Comment »

chris on December 22nd 2008 in /dev/random

Handy Git Command: Stash

I don’t remember where I found this nugget of joy but if you’ve started making changes to files and found yourself in a deep morass from which extrication is all but impossible and you want to revert back, this seems to work quite nicely:

git stash save --keep-index

After that, you can drop that stash with a git stash drop command if you like.

3 Comments »

chris on December 5th 2008 in /dev/random

The Silent Treatment

This place has been pretty quite for awhile now because the RSI I’ve been battling has made most non-critical keyboarding out of the question. Hasn’t stopped me from building up a collection of ideas for posts but for the near-term they’ll just have to wait.

Comments Off

chris on December 2nd 2008 in /dev/random