[AstroPy] Time custom formats
paul.ray at nrl.navy.mil
Fri Feb 19 08:51:46 EST 2016
I've been trying to figure out how to print an astropy.Time with a custom string format and have not been able to.
In : t = astropy.time.Time.now()
In : t.yday
Now, what if I want the string '2016-050T13:45:21' instead?
What I'd like is basically the astropy equivalent of the C library strftime().
I see there is a way to make a new subclass of TimeFormat, but I don't really want a whole new format, just a way to customize the string representation (possibly for input as well as output). Maybe all I need is an example of how to subclass TimeFormat to accomplish that. I had some trouble getting it to work in the little experimenting I did.
Thanks for any tips,
More information about the AstroPy