Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chile2010 titles #272

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

rjleveque
Copy link
Member

Improve the title on plots to use hr:min:sec format.

@mandli
Copy link
Member

mandli commented Jun 21, 2017

Wouldn't it be easier to use datetime?

@rjleveque
Copy link
Member Author

Do you know how to easily? I guess you can make a datetime.time object and then use time.isoformat() to get such a string, but to make the object in the first place you have to convert from seconds to hours, minutes, seconds (since it requires seconds <= 60 ) so that all seems more complicated than just constructing the string as I did.

@mandli
Copy link
Member

mandli commented Jun 21, 2017

Had to remember how I did this once as it is not exactly the most intuitive thing. If you define

my_time = datetime.datetime(2017, 1, 1) + datetime.timdelta(seconds=my_seconds)

the object my_time will be an offset from the base date with my_seconds > 60 allowed. Then you can use the string formatting of datetime to output the string you are looking for. I think

my_time.strftime("%X")

might do what you want.

@mandli mandli added this to the 5.6.1 milestone Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants