Giter VIP home page Giter VIP logo

arrow's Introduction

Arrow - Better date & time manipulation for Python

Build Status

See documentation at: crsmithdev.com/arrow

Overview

Arrow is a Python module that offers a smooth, sensible way of creating, maniuplating, formatting and converting dates and times. Arrow is simple, lightweight and heavily inspired by moment.js and requests.

Why?

Python's standard library and some other low-level modules offer complete functionality but don't work very well from a usability perpsective:

  • Too many modules: datetime, time, calendar, dateutil, pytz
  • Time zones and timestamp conversions are verbose and error-prone
  • Time zones are explicit, naievete is the norm
  • Gaps in functionality: ISO-8601 parsing, timespans, humanization

Key features

  • Implements the datetime iterface
  • TZ-aware & UTC by default
  • Concise, intelligent interface for creation
  • Attribute manipulation, plural names
  • Rich parsing & formatting options
  • Timezone conversion
  • Simple timestamp handling
  • Time spans, floors and ceilings
  • Humanization

Installation

$ pip install arrow

Quickstart

>>> import arrow
>>> utc = arrow.get()
>>> utc
<Arrow [2013-05-07T03:56:38.560988+00:00]>
>>> utc.hours -=1
>>> utc
<Arrow [2013-05-07T02:56:38.560988+00:00]>
>>> local = utc.to('US/Pacific')
>>> local
<Arrow [2013-05-06T19:56:38.560988-07:00]>
>>> local.timestamp
1367895398
>>> local.format('YYYY-MM-DD HH:mm:ss ZZ')
'2013-05-06 19:56:38 -07:00'

Changelog

  • 0.2.0

    • Reimplemented as datetime replacement
    • Added date parsing
    • Added date formatting
    • Added floor, ceil and span methods
    • Added datetime methods for drop-in replacement
    • Added clone method
    • Added get, now and utcnow API methods
  • 0.1.6

    • Added humanized time deltas
    • Fixed numerous issues with conversions related to daylight savings time
    • Fixed some inconsistencies in time zone names
    • str uses ISO formatting
    • eq implemented for basic comparison between Arrow objects
  • 0.1.5

    • Started tracking changes
    • Added parsing of ISO-formatted time zone offsets (e.g. '+02:30', '-05:00')
    • Fixed some incorrect timestamps with delta / olson time zones
    • Fixed formatting of UTC offsets in TimeStamp's str method

arrow's People

Contributors

crsmithdev avatar junckritter avatar minaeid90 avatar zed avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.