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

A library that we can get datetime simply and easily

Installation

Install using pip:

pip install sdate

Install using source code:

git clone https://github.com/qiueer/sdate
cd sdate
python setup.py install

Usage

Get datetime information currently:

>>> from sdate import sdate
>>> sdate()
{       'date': '2016-03-14',
        'time': '11:42:21',
        'datetime': '2016-03-14 11:42:21',
        'datetimestr': '20160314114221284',
        'day': 14,
        'hour': 11,
        'iso8601': '2016-03-14T11:42:21',
        'iso8601_ms': '2016-03-14T11:42:21.284319+08:00',
        'iso8601_ms_tz': '2016-03-14T11:42:21.284319+08:00',
        'iso8601_tz': '2016-03-14T11:42:21+08:00',
        'microsecond': 284319,
        'minute': 42,
        'month': 3,
        'second': 21,
        'tzname': 'GMT+8',
        'unix_timestamp': 1457926941,
        'weekday': 0,
        'year': 2016}

Get datetime information, before four hours:

>>> from sdate import sdate
>>> sdate(hours=-4)
{   'date': '2016-03-14',
    'time': '07:51:12',
    'datetime': '2016-03-14 07:51:12',
    'datetimestr': '20160314075112200',
    'day': 14,
    'hour': 7,
    'iso8601': '2016-03-14T07:51:12',
    'iso8601_ms': '2016-03-14T07:51:12.200265+08:00',
    'iso8601_ms_tz': '2016-03-14T07:51:12.200265+08:00',
    'iso8601_tz': '2016-03-14T07:51:12+08:00',
    'microsecond': 200265,
    'minute': 51,
    'month': 3,
    'second': 12,
    'tzname': 'GMT+8',
    'unix_timestamp': 1457913072,
    'weekday': 0,
    'year': 2016}

Convert unix timestamp to sdate, that we can use it to get more information:

>>> from sdate import sdate
>>>sd=sdate().from_unix_timestamp(1457895842)
>>>print sd
{   'date': '2016-03-14',
    'time': '03:04:02',
    'datetime': '2016-03-14 03:04:02',
    'datetimestr': '201603140304020',
    'day': 14,
    'hour': 3,
    'iso8601': '2016-03-14T03:04:02',
    'iso8601_ms': '2016-03-14T03:04:02+08:00',
    'iso8601_ms_tz': '2016-03-14T03:04:02+08:00',
    'iso8601_tz': '2016-03-14T03:04:02+08:00',
    'microsecond': 0,
    'minute': 4,
    'month': 3,
    'second': 2,
    'tzname': 'GMT+8',
    'unix_timestamp': 1457895842,
    'weekday': 0,
    'year': 2016}
>>> sd.datetime_str()
'201603140304020'

Reset sdate, the arguments are same as Constructor:

>>>sd=sdate().from_unix_timestamp(1457895842)
>>>print sd
{   'date': '2016-03-14',
    'time': '03:04:02',
    'datetime': '2016-03-14 03:04:02',
    'datetimestr': '201603140304020',
    'day': 14,
    'hour': 3,
    'iso8601': '2016-03-14T03:04:02',
    'iso8601_ms': '2016-03-14T03:04:02+08:00',
    'iso8601_ms_tz': '2016-03-14T03:04:02+08:00',
    'iso8601_tz': '2016-03-14T03:04:02+08:00',
    'microsecond': 0,
    'minute': 4,
    'month': 3,
    'second': 2,
    'tzname': 'GMT+8',
    'unix_timestamp': 1457895842,
    'weekday': 0,
    'year': 2016}
>>> sd.reset()
{   'date': '2016-03-14',
    'time': '13:05:13',
    'datetime': '2016-03-14 13:05:13',
    'datetimestr': '20160314130513729',
    'day': 14,
    'hour': 13,
    'iso8601': '2016-03-14T13:05:13',
    'iso8601_ms': '2016-03-14T13:05:13.729126+08:00',
    'iso8601_ms_tz': '2016-03-14T13:05:13.729126+08:00',
    'iso8601_tz': '2016-03-14T13:05:13+08:00',
    'microsecond': 729126,
    'minute': 5,
    'month': 3,
    'second': 13,
    'tzname': 'GMT+8',
    'unix_timestamp': 1457931913,
    'weekday': 0,
    'year': 2016}

Methods that we can use:

>>>sd.weekofday()
0
>>>sd.hour()
13
>>>sd.month()
3
>>>sd.datetime_str()
'20160314130513729'
>>>sd.iso8601_ms_tz()
'2016-03-14T13:05:13.729126+08:00'
>>>sd.datetime()
'2016-03-14 13:05:13'
>>>sd.iso8601_ms()
'2016-03-14T13:05:13.729126+08:00'
>>>sd.second()
13
>>>sd.iso8601_tz()
2016-03-14T13:05:13+08:00
>>>sd.minute()
5
>>>sd.year()
2016
>>>sd.date()
'2016-03-14'
>>>sd.unix_timestamp()
1457931913
>>>sd.iso8601()
'2016-03-14T13:05:13'
>>>sd.day()
14
>>>sd.microsecond()
729126
>>>sd.tzname()
'GMT+8'
>>>sd.time()
'13:05:13'

Support + Contributing

Feel free to make pull requests, or report issues via the repo:

https://github.com/qiueer/sdate

Release History

Release History

0.1.2

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.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
sdate-0.1.2.tar.gz (3.8 kB) Copy SHA256 Checksum SHA256 Source Mar 15, 2016

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