I have a server running with the timezone set to UTC. It seemed like that was generally a good practice (please correct me if I'm wrong).

Anyhow, one of the servers I connect to, in order to scp files, is running on EDT and stores files that I need to copy in the format /path/to/filename/data20120913

I looked at trying to rsync files using something like find's -mtime -1 flag for files modified in the last day, but I didn't have any luck.

I don't mind just using scp to copy the current day's file, but as of right now there is a 4-hour window where running date +%Y%m%d will give a different day on each server and that bugs me a little.

Looking through man date I see that I can have the time output as UTC, but I don't see a way to have it output as another timezone like EDT

I suppose I could also use something like the GNU date extension date -d 20100909 +%s to get the date in seconds from the epoch, apply a manual 4 * 60 * 60 second calculation, and see about rendering that as a date - but then when daylight time kicks in it will still be an hour off.

Is there a simpler way to output the date in a YYYYMMDD format for EDT on a server that is set to UTC ?

EDT is not a recognized timezone- in Linux, at least. See my "Be careful!" answer below for the whole ugly story. If EDT is recognized on your brand of *NIX, you should still exercise caution and double-check your timezone string.
–
Mike SMar 17 at 15:27

However, if your friend lives in the mystic land of Gobbledygook and its zone info coincides with your own, you can have date output the time in Gobbledygook's zone and it will be happy to do so with nary an exit value to let you know that the zone is not known to it:

The date syntax is arcane and error-prone, which makes a command-line invocation a pain. I therefore wrote a small script (I named it worldtime), which will print the specified (or current) time from base time zome (your local one) in some other time zones and the converse.

Here it is. Adjust it to match your needs, put it in your path, and make it executable.

You can edit your answer to fix the formatting. Use the preview function to see if it's how it should be. Otherwise, this question seems to already have proper answers. Also, we like it for answers to not be just code: it's much more helpful to future readers to explain in detail how your solution works.
–
dhagMar 31 at 15:46