php oneliner iso8601 now with time zone offset.
php -r 'putenv("TZ=US/Eastern");echo date("c")."\n";'
Here is a session using it:
new-host-2:~ lent$ uname -v
Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386
new-host-2:~ lent$ php -r 'putenv("TZ=US/Eastern");echo date("c")."\n";'
2011-10-08T10:08:48-04:00
new-host-2:~ lent$ # Now for a historically weird one
new-host-2:~ lent$ php -r 'putenv("TZ=US/East-Indiana");echo date("c")."\n";'
2011-10-08T10:10:05-04:00
new-host-2:~ lent$ php -r 'putenv("TZ=US/Central");echo date("c")."\n";'
2011-10-08T09:12:05-05:00
new-host-2:~ lent$ php -r 'putenv("TZ=US/Guam");echo date("c")."\n";'
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in Command line code on line 1
2011-10-08T14:11:47+00:00
new-host-2:~ lent$ #Whoops! Pacific/Guam, not US/Guam
new-host-2:~ lent$ php -r 'putenv("TZ=Pacific/Guam");echo date("c")."\n";'
2011-10-09T00:12:40+10:00
new-host-2:~ lent$