Printing time in "at" format?

Hans Mulder hansmu at xs4all.nl
Wed Nov 21 07:14:32 EST 2012


On 20/11/12 17:18:33, Roy Smith wrote:
> I need to talk to an API which requires (for reasons totally beyond my
> comprehension), time specified in "at" format, i.e. the format
> accepted by the unix "at" command.  This allows you to do such bizarre
> things as use "teatime" to indicate 4:00 PM.  The best I can find for
> a specification is http://tinyurl.com/d5vddoa.
> 
> Before I dive into this too far, has anybody already written some code
> which formats times like that?

On my machine x.strftime("%H:%m %d.%m.%Y") formats datetime objects
in a format that at(1) understands:

$ > at -f my_job '12:11 21.11.2012'
at: trying to travel back in time


Hope this helps,

-- HansM



More information about the Python-list mailing list