import time


def formatFnameDate(when=None):
    """Given a time in seconds since the epoch, returns a date value suitable
       for use as part of a filename, in YYYYMMDD format.  Defaults to the
       current time."""
    if when is None:
        when = time.time()
    return time.strftime("%Y%m%d", time.localtime(when))