[AstroPy] How to plot a time format with hours only?

Eric L. N. Jensen ejensen1 at swarthmore.edu
Tue Jul 6 15:15:22 EDT 2021


> On Jul 6, 2021, at 2:59 PM, Miro Saide <mirosaide at gmail.com> wrote:
> 
> I wonder if is there a way to approximate the minutes to our when I calculate the rise and set time?
> 

Sure - just take the minutes and seconds and convert them to hours. For example:

from astropy.time import Time
now = Time.now()
print(now.ymdhms.hour + now.ymdhms.minute/60. + now.ymdhms.second/3600.)

to get the current time in decimal fractional hours. 

Eric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20210706/2b1429a7/attachment.html>


More information about the AstroPy mailing list