Socket
Socket
Sign inDemoInstall

py-pretty

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Protect your apps from supply chain attacks

Install

py-pretty

Formats dates, numbers, etc. in a pretty, human readable format.

    1

Maintainers
1

Readme

Sample code::

    from datetime import datetime, timedelta
    now = datetime.now()
    hrago = now - timedelta(hours=1)
    yesterday = now - timedelta(days=1)
    tomorrow = now + timedelta(days=1)
    dayafter = now + timedelta(days=2)

    import pretty
    print pretty.date(now)                      # 'now'
    print pretty.date(hrago)                    # 'an hour ago'
    print pretty.date(hrago, short=True)        # '1h ago'
    print pretty.date(hrago, asdays=True)       # 'today'
    print pretty.date(yesterday, short=True)    # 'yest'
    print pretty.date(tomorrow)                 # 'tomorrow'

FAQs


Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc