Wednesday, 17 April 2019

How do I convert the output of "getctime()" and "getmtime()" into the time format required by HTML's "published_time" and "modified_time" META tags?

My website's articles are written using .md files, to get the created and modified times of these files I use the os.path.getctime() and os.path.getmtime() methods.

The output of these methods look like this:

  • 1553541590.723329
  • 1553541590.723329

While HTML requires this format:

  • 2001-09-17T05:59:00+01:00
  • 2013-09-16T19:08:47+01:00

I have two questions regarding this matter:

  1. What's are the names of these two time formats?
  2. How do I change the output of those methods to look like the required HTML format?

Thanks.



from How do I convert the output of "getctime()" and "getmtime()" into the time format required by HTML's "published_time" and "modified_time" META tags?

No comments:

Post a Comment