This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# Easy_Date #

* https://github.com/ralphavalon/easy_date

* https://pypi.python.org/pypi/easy-date

Let's face it: there's no JodaTime for Python, and dealing with date, datetime, timestamp in Python it's not very readable or easy to understand. Easy_date can convert between str, date, datetime and timestamp easily for you and it is readable.

### Example - String to String ###

```
import easy_date

str_date = '25/12/2014' #%d/%m/%Y
new_str_date = easy_date.convert_from_string(str_date, '%d/%m/%Y', '%m-%d-%Y') # str is default return type
```

**new_str_date** will be **12-25-2014**.

### Installation ###

Install the latest stable release with:

``pip install easy_date``

or

``easy_install -U easy_date``

There are no hard dependencies other than the Python standard library.
It works with Python **2.6+** and **3.x**, but it wasn't tested on previous versions.


### How do I convert dates? ###

#### Can use two ways:

* Using **easy_date**

```
from datetime import date, datetime
import easy_date

str_date = '25/12/2014' #%d/%m/%Y

#convert_from_string(string, current_format, to_format, to_type)

new_str_date = easy_date.convert_from_string(str_date, '%d/%m/%Y', '%m-%d-%Y') # str is default return type

date_time = easy_date.convert_from_string(str_date, '%d/%m/%Y', '%Y-%m-%d', datetime)

timestamp = easy_date.convert_from_string(str_date, '%d/%m/%Y', None, float) # e.g. 1419472800.0

my_date = easy_date.convert_from_string(str_date, '%d/%m/%Y', None, date)

```


* Using **date_converter**

```
from datetime import date, datetime
import date_converter

str_date = '25/12/2014' #%d/%m/%Y

#string_to_string(string, current_format, to_format)
new_str_date = date_converter.string_to_string(str_date, '%d/%m/%Y', '%m-%d-%Y')

#string_to_datetime(string, current_format, to_format)
date_time = date_converter.string_to_datetime(str_date, '%d/%m/%Y', '%Y-%m-%d')

#string_to_timestamp(string, current_format)
timestamp = date_converter.string_to_timestamp(str_date, '%d/%m/%Y')

#string_to_date(string, current_format)
my_date = date_converter.string_to_date(str_date, '%d/%m/%Y')

```

### Available methods ###

* from **easy_date**


```
#Acceptable types: (str, datetime.datetime, datetime.date, float)
convert_from_string(string, current_format, to_format, to_type=str)

#Acceptable types: (str, datetime.datetime, datetime.date, float)
convert_from_datetime(from_datetime, to_format, to_type=str)

#Acceptable types: (str, datetime.datetime, float)
convert_from_date(from_date, to_format, to_type=str)

#Acceptable types: (str, datetime.datetime, datetime.date)
convert_from_timestamp(timestamp, to_format, to_type=str)

```


* from **date_converter**

```
#from datetime.date
date_to_datetime(from_date)
date_to_string(from_date, to_format)
date_to_timestamp(from_date)

#from datetime.datetime
datetime_to_date(from_datetime)
datetime_to_datetime(from_datetime, to_format)
datetime_to_string(from_datetime, to_format)
datetime_to_timestamp(from_datetime)

#from str
string_to_date(string, current_format)
string_to_datetime(string, current_format, to_format=None)
string_to_string(string, current_format, to_format)
string_to_timestamp(string, current_format)

#from float
timestamp_to_date(timestamp)
timestamp_to_datetime(timestamp, to_format=None)
timestamp_to_string(timestamp, to_format)

```

### Development ###

* All tests were executed using Brazil (America/Sao_Paulo) timezone. So, if you're not on this timezone and want to run tests, you can do:

```
sudo ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
```

* You can back to your timezone using the same way.
* You can take a look on **travis_setup.sh**.

### Contribution guidelines ###

* Every help or suggestion is welcome.

### License ###

* Code and documentation are available according to the MIT License (see LICENSE.md).
Release History

Release History

0.1.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
easy-date-0.1.4.tar.gz (3.0 kB) Copy SHA256 Checksum SHA256 Source May 10, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting