create account

Learn Python Series (#21) - Handling Dates and Time Part 1 by scipio

View this thread on: hive.blogpeakd.comecency.com
· @scipio · (edited)
$124.14
Learn Python Series (#21) - Handling Dates and Time Part 1
# Learn Python Series (#21) - Handling Dates and Time - Part 1

![python_logo.png](https://cdn.utopian.io/posts/7751fd308b7b02f9b3997355b4f51f4d0ff0python_logo.png)

#### Full additional iPython tutorial sample code file included here:
[https://github.com/realScipio/learn-python-series/blob/master/datetime-01.ipynb](https://github.com/realScipio/learn-python-series/blob/master/datetime-01.ipynb)

#### What Will I Learn?
- You will learn about the existence and conceptual use cases of the built-in Python modules `time`, `calendar` and `datetime`, and about an external package called `maya` that also conveniently handles dates and times. The first two mentioned modules are in-depth discussed in this tutorial episode;
- Regarding the `time` module, the most important methods will be discussed;
- on top of that I will explain the constructs of full-9-time tuples and time_struct objects, as well as about time formatting strings directives;
- we will then discuss a complete back-and-forth time object vs time string formatting / parsing example, with which you'll probably be able to do just about anything you want to regarding the handling of dates and times with respect to UNIX timestamps (epoch-related), time_struct objects and time strings;
- finally we'll briefly touch upon a few convenient `calendar` module methods that provide some additional value.

#### Requirements
- A working modern computer running macOS, Windows or Ubuntu;
- An installed Python 3(.6) distribution, such as (for example) the Anaconda Distribution;
- The ambition to learn Python programming;

#### Difficulty
Intermediate

#### Curriculum (of the `Learn Python Series`):
- [Learn Python Series - Intro](https://utopian.io/utopian-io/@scipio/learn-python-series-intro)
- [Learn Python Series (#2) - Handling Strings Part 1](https://utopian.io/utopian-io/@scipio/learn-python-series-2-handling-strings-part-1)
- [Learn Python Series (#3) - Handling Strings Part 2](https://utopian.io/utopian-io/@scipio/learn-python-series-3-handling-strings-part-2)
- [Learn Python Series (#4) - Round-Up #1](https://utopian.io/utopian-io/@scipio/learn-python-series-4-round-up-1)
- [Learn Python Series (#5) - Handling Lists Part 1](https://utopian.io/utopian-io/@scipio/learn-python-series-5-handling-lists-part-1)
- [Learn Python Series (#6) - Handling Lists Part 2](https://utopian.io/utopian-io/@scipio/learn-python-series-6-handling-lists-part-2)
- [Learn Python Series (#7) - Handling Dictionaries](https://utopian.io/utopian-io/@scipio/learn-python-series-7-handling-dictionaries)
- [Learn Python Series (#8) - Handling Tuples](https://utopian.io/utopian-io/@scipio/learn-python-series-8-handling-tuples)
- [Learn Python Series (#9) - Using Import](https://utopian.io/utopian-io/@scipio/learn-python-series-9-using-import)
- [Learn Python Series (#10) - Matplotlib Part 1](https://utopian.io/utopian-io/@scipio/learn-python-series-10-matplotlib-part-1)
- [Learn Python Series (#11) - NumPy Part 1](https://utopian.io/utopian-io/@scipio/learn-python-series-11-numpy-part-1)
- [Learn Python Series (#12) - Handling Files](https://utopian.io/utopian-io/@scipio/learn-python-series-12-handling-files)
- [Learn Python Series (#13) - Mini Project - Developing a Web Crawler Part 1](https://utopian.io/utopian-io/@scipio/learn-python-series-13-mini-project-developing-a-web-crawler-part-1)
- [Learn Python Series (#14) - Mini Project - Developing a Web Crawler Part 2](https://utopian.io/utopian-io/@scipio/learn-python-series-14-mini-project-developing-a-web-crawler-part-2)
- [Learn Python Series (#15) - Handling JSON](https://utopian.io/utopian-io/@scipio/learn-python-series-15-handling-json)
- [Learn Python Series (#16) - Mini Project - Developing a Web Crawler Part 3](https://utopian.io/utopian-io/@scipio/learn-python-series-16-mini-project-developing-a-web-crawler-part-3)
- [Learn Python Series (#17) - Roundup #2 - Combining and analyzing any-to-any multi-currency historical data](https://utopian.io/utopian-io/@scipio/learn-python-series-17-roundup-2-combining-and-analyzing-any-to-any-multi-currency-historical-data)
- [Learn Python Series (#18) - PyMongo Part 1](https://utopian.io/utopian-io/@scipio/learn-python-series-18-pymongo-part-1)
- [Learn Python Series (#19) - PyMongo Part 2](https://utopian.io/utopian-io/@scipio/learn-python-series-19-pymongo-part-2)    
 - [Learn Python Series (#20) - PyMongo Part 3](https://steemit.com/utopian-io/@scipio/learn-python-series-20-pymongo-part-3) 

# Learn Python Series (#21) - Handling Dates and Time Part 1
I think **it's about time** ;-) to discuss with you some fundamentals regarding the handling of different date & time formats and functionality. There are a lot of programming situations in which dates and times play an important role; in some of the previous `Learn Python Series`  episodes, where we discussed the historical currency daily openings for example, dates were involved. We only created a (JSON-based) list from old to new from it, and plotted the daily price values, but what if we wanted to know _"what was the price 34 days before March 18 2018?"_ For situations like that, some knowledge regarding how to handle dates and times is needed.

Python does not include default / native data types for dates and times (as it does for a string and a list for example), but we can make use of the functionality provided in the `time`, `datetime` and `calendar` modules.

- The `datetime` module includes functionality for handling dates, times, and combinations, and you can perform some arithmetic and comparison with it. It can also do some basic conversion between datetime objects and formatted strings.
- The `time` module focuses on time-related functions, but handles dates as well to a certain extent, and it includes some formatting functionality for switching between time_structs / 9-tuples and strings.
- The `calendar` module can be used to format representations of days, weeks, months and years, and you can for example compute the day of the week on any date.

And then there's also for example the excellent external `Maya` package available to work with...

Lots to learn! So let's begin!

# The `time` module

### `time.time()`
Probably the most used `time` method is `time.time()`: it returns the number of seconds passed between "now" (the exact moment you're calling `time.time()`) and the **epoch**, being **Thursday, January 1st, 1970, 00:00:00 UTC, on UNIX-like systems**.


```python
import time
localtime = time.time()
print(type(localtime), localtime)
```

    <class 'float'> 1525031396.1437771


**Nota bene:** oftentimes, when calling `time.time()` you don't want the decimal digits but rounded seconds since the epoch. In order to do so, just convert the default float `time.time()` returns to an integer, like so:


```python
localtime = int(time.time())
print(type(localtime), localtime)
```

    <class 'int'> 1525031430


### `time.sleep()`
This pauses (suspends) the thread running for the number of seconds passed to it as its argument.


```python
start = time.time()
time.sleep(5)
end = time.time()
print(end-start)
```

    5.0028228759765625


**PS:** the time passed in between `start` and `end` is oftentimes called the "wall time".

### `time.localtime()`
In case you're interested in returning a `time-tuple` or a `time.struct_time` object returned, which both are like a wrapper holding the information about some point in time, use `time.localtime()` and pass in the amount of ticks (seconds) passed since the epoch, or don't use an argument to get the current time.


```python
some_other_time = time.localtime(123)
print(some_other_time)

current_time = time.localtime()
print(current_time)
```

    time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=1, tm_min=2, tm_sec=3, tm_wday=3, tm_yday=1, tm_isdst=0)
    time.struct_time(tm_year=2018, tm_mon=5, tm_mday=1, tm_hour=19, tm_min=11, tm_sec=47, tm_wday=1, tm_yday=121, tm_isdst=1)


If you're wondering how to use such a `time.struct_time` object: you're able to format it to your liking into a string via `time.strftime()` (see below).

### `time.mktime()`
The `time.mktime()` is the inverse of what `time.localtime()` does. As an argument, just pass in the `time.struct_time` object (or full 9-tuple). 

`time.mktime()` will then return a floating point number, indicating the seconds since the epoch (as is the case with `time.time()`).


**Full 9-time-tuple:**

Index number: Meaning

- 0: 4-digit year notation (e.g. 2018)
- 1: Month (e.g. 2 for February)
- 2: Day (e.g. 31 for the last day of December)
- 3: Hour (e.g. 23 for 11 PM)
- 4: Minute (e.g. 59 for the last minute of the hour)
- 5: Second (can even be 60 or 61 for leap seconds!)
- 6: Day of the Week (e.g. 0 for a Monday, 6 for a Sunday)
- 7: Day of the Year (e.g. 1 for Jan., 1st)
- 8: Daylight savings (-1, 0, 1, where `-1` means the system library decides)

**Struct_time:**

Works exactly the same! :-)

**PS:** when passing in a 9-tuple as the argument to `time.mktime()` to get the epoch equivalent, you don't need to worry about which day of the week or which day of the year that specific date is, you can pass in `0` for indexes 6 and 7 without a problem. However, for the last (8th) index, just pass in `-1` to let the system decide whether or not to compensate for daylight savings.


```python
some_moment = (2018, 5, 1, 21, 20, 0, 0, 0, -1)
epoch = time.mktime(some_moment)
print(epoch)

some_moment_string = time.ctime(epoch)
print(some_moment_string)
```

    1525202400.0
    Tue May  1 21:20:00 2018


### `time.strftime()`
`time.strftime()` returns a string, you can format precisely using a format string with directives and helper string components (if you want to), and by passing in a time-tuple (a `time.struct_time` object) as a second argument (being either the current time / no argument, or any time in the past or future).


```python
localtime = time.localtime()

# Two examples regarding time string formatting
print(time.strftime('Today (%Y-%m-%d) it\'s a %A', localtime))
print(time.strftime('Right now: %A, %d %b %Y (%H:%M:%S)', localtime))
```

    Today (2018-05-01) it's a Tuesday
    Right now: Tuesday, 01 May 2018 (20:25:04)


**PS:** 
The following (common) directives, and their meaning, are used a lot with time string formatting:

- `%a`: abbreviated weekday name
- `%A`: full weekday name
- `%b`: abbreviated month name
- `%B`: full month name
- `%c`: date/time representation of the current locale (e.g. `Sun Apr 29 22:15:37 2018`)
- `%d`: day of the month (01 .. 31)
- `%H`: 24-hour clock hour (00 ..23)
- `%j`: day of the year (001 .. 366)
- `%m`: month (01 ..12)
- `%M`: minute (00 ..59)
- `%S`: seconds
- `%w`: weekday (0 .. 6)
- `%W`: week number (00 .. 53)
- `%Y`: 4-digit year
- `%Z`: Timezone name

### `time.strptime()`
Works the other way around as `time.strftime()` does: `time.strptime()` parses a time-string (as first argument) which represents a certain date/time, and a format string following a specific format as a parser helper. It returns a `time.struct_time` object, and works with the same directives as mentioned right above regarding `time.strftime()`.


```python
localtime = time.strptime("14 Feb 2015", "%d %b %Y")
print(localtime)
```

    time.struct_time(tm_year=2015, tm_mon=2, tm_mday=14, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=45, tm_isdst=-1)


### `time.asctime()`
Returns a (current locale-based) date/time string representation of the time-tuple (or blank) passed to it as its argument.


```python
localtime = time.asctime()
print(localtime)
```

    Tue May  1 20:28:04 2018


### `time.ctime()`
About the same as `time.asctime()` but possible to pass in nothing as an argument ("now"), or seconds since the UNIX epoch:


```python
localtime = time.ctime()
print(localtime)
```

    Tue May  1 20:28:15 2018



```python
localtime = time.ctime(123)
print(localtime)
```

    Thu Jan  1 01:02:03 1970


# Let's wrap things up with a nice back-and-forth conversion example combining it all!

Say, you are working with some date/time string in a specific format. And you just want to use the `time` module, add some time to it, and present the new time string in the same format.

Then this is how to go about that:


```python
# Some moment in time
x_date_string = "14 Feb 2015 09:15:00"
x_time_struct = time.strptime(x_date_string, "%d %b %Y %H:%M:%S")
x_epoch = time.mktime(x_time_struct)

# 15 minutes later
y_epoch = x_epoch + 900
y_time_struct = time.localtime(y_epoch)
y_date_string = time.strftime("%d %b %Y %H:%M:%S", y_time_struct)

print(x_date_string)
print(y_date_string)
```

    14 Feb 2015 09:15:00
    14 Feb 2015 09:30:00


# The `calendar` module
Although I don't use the `calendar` module too much, personally, I still wanted to (briefly) discuss some basic features it provides. I deliberately picked a few methods that add some additional value on top of what we've discussed above regarding functionality of the `time` module.

### `calendar.calendar()`
With this method, you're able to conveniently print an entire year's calendar.


```python
import calendar
my_cal = calendar.calendar(2018)
print(my_cal)
```

                                      2018
    
          January                   February                   March
    Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th
              1  2  3  4                         1                         1
     5  6  7  8  9 10 11       2  3  4  5  6  7  8       2  3  4  5  6  7  8
    12 13 14 15 16 17 18       9 10 11 12 13 14 15       9 10 11 12 13 14 15
    19 20 21 22 23 24 25      16 17 18 19 20 21 22      16 17 18 19 20 21 22
    26 27 28 29 30 31         23 24 25 26 27 28         23 24 25 26 27 28 29
                                                        30 31
    
           April                      May                       June
    Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th
           1  2  3  4  5                   1  2  3       1  2  3  4  5  6  7
     6  7  8  9 10 11 12       4  5  6  7  8  9 10       8  9 10 11 12 13 14
    13 14 15 16 17 18 19      11 12 13 14 15 16 17      15 16 17 18 19 20 21
    20 21 22 23 24 25 26      18 19 20 21 22 23 24      22 23 24 25 26 27 28
    27 28 29 30               25 26 27 28 29 30 31      29 30
    
            July                     August                  September
    Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th
           1  2  3  4  5                      1  2          1  2  3  4  5  6
     6  7  8  9 10 11 12       3  4  5  6  7  8  9       7  8  9 10 11 12 13
    13 14 15 16 17 18 19      10 11 12 13 14 15 16      14 15 16 17 18 19 20
    20 21 22 23 24 25 26      17 18 19 20 21 22 23      21 22 23 24 25 26 27
    27 28 29 30 31            24 25 26 27 28 29 30      28 29 30
                              31
    
          October                   November                  December
    Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th      Fr Sa Su Mo Tu We Th
              1  2  3  4                         1          1  2  3  4  5  6
     5  6  7  8  9 10 11       2  3  4  5  6  7  8       7  8  9 10 11 12 13
    12 13 14 15 16 17 18       9 10 11 12 13 14 15      14 15 16 17 18 19 20
    19 20 21 22 23 24 25      16 17 18 19 20 21 22      21 22 23 24 25 26 27
    26 27 28 29 30 31         23 24 25 26 27 28 29      28 29 30 31
                              30
    


### `calendar.month()`
With `calendar.month()` you can pass in both a year and month number as arguments, and print just that single month calender, like so:


```python
import calendar

apr_2018 = calendar.month(2018, 4)
print(apr_2018)
```

         April 2018
    Mo Tu We Th Fr Sa Su
                       1
     2  3  4  5  6  7  8
     9 10 11 12 13 14 15
    16 17 18 19 20 21 22
    23 24 25 26 27 28 29
    30
    


### `calendar.monthrange()`
The `calendar.monthrange()` method returns a tuple of two integers, where the first represents the "weekday code" for the first day of that month (monday: 0, sunday: 6), and the second returns the amount of days in that month. This can be convenient to serve as input for other functions in your code.


```python
calendar.monthrange(2018, 4)
```




    (6, 30)



### `calendar.weekday()`
The `calendar.weekday()` method simply returns the weekday number for a given date.


```python
calendar.weekday(2018,4,28)
```




    5



### `calendar.isleap()`
The `calendar.isleap()` method returns `True` or `False` whether the year as its argument is a leap year or not.


```python
calendar.isleap(2018)
```




    False



### `calendar.leapdays()`
And as a final method (for this tutorial episode) the `calendar.leapdays()` method returns the number of leapdays occurring within in interval of two years.


```python
calendar.leapdays(1978,2018)
```




    10



# What did we learn, hopefully?

In this episode, we first discussed the existance of several date/time modules within Python (`time`, `datetime`, and `calendar`) and we then focused on the `time` module specifically, going over the various built-in methods in the `time` module and about how to use them, providing small code examples for each method discussed.

We also discussed and listed time string formatting directives, and the index numbers and meanings of full-9-time tuples and time_struct objects, which are all needed of course to convert between time objects and strings, while in the mean time being able to do some calculations with them (using seconds as the default unit because of the UNIX timestamps nature, which are seconds as well). We then wrapped things up, considering the `time` module with a real-life back-and-forth conversion example; tinkering around with the format strings will probably give you all the tools you need to work with, and so some time-offsetting coding on, any kind of date/time format string.

In the next `Learn Python Series` episodes, we'll continue with the `datetime` module, and the external `Maya` package!

### Thank you for your time!
  
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 68 others
properties (23)
authorscipio
permlinklearn-python-series-21-handling-dates-and-time-part-1
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":81598961,"name":"cpython","full_name":"python/cpython","html_url":"https://github.com/python/cpython","fork":false,"owner":{"login":"python"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","steemdev","steemstem","open-source","python"],"users":["scipio"],"links":["https://cdn.utopian.io/posts/7751fd308b7b02f9b3997355b4f51f4d0ff0python_logo.png","https://github.com/realScipio/learn-python-series/blob/master/datetime-01.ipynb","https://utopian.io/utopian-io/@scipio/learn-python-series-intro","https://utopian.io/utopian-io/@scipio/learn-python-series-2-handling-strings-part-1","https://utopian.io/utopian-io/@scipio/learn-python-series-3-handling-strings-part-2","https://utopian.io/utopian-io/@scipio/learn-python-series-4-round-up-1","https://utopian.io/utopian-io/@scipio/learn-python-series-5-handling-lists-part-1","https://utopian.io/utopian-io/@scipio/learn-python-series-6-handling-lists-part-2","https://utopian.io/utopian-io/@scipio/learn-python-series-7-handling-dictionaries","https://utopian.io/utopian-io/@scipio/learn-python-series-8-handling-tuples","https://utopian.io/utopian-io/@scipio/learn-python-series-9-using-import","https://utopian.io/utopian-io/@scipio/learn-python-series-10-matplotlib-part-1","https://utopian.io/utopian-io/@scipio/learn-python-series-11-numpy-part-1","https://utopian.io/utopian-io/@scipio/learn-python-series-12-handling-files","https://utopian.io/utopian-io/@scipio/learn-python-series-13-mini-project-developing-a-web-crawler-part-1","https://utopian.io/utopian-io/@scipio/learn-python-series-14-mini-project-developing-a-web-crawler-part-2","https://utopian.io/utopian-io/@scipio/learn-python-series-15-handling-json","https://utopian.io/utopian-io/@scipio/learn-python-series-16-mini-project-developing-a-web-crawler-part-3","https://utopian.io/utopian-io/@scipio/learn-python-series-17-roundup-2-combining-and-analyzing-any-to-any-multi-currency-historical-data","https://utopian.io/utopian-io/@scipio/learn-python-series-18-pymongo-part-1","https://utopian.io/utopian-io/@scipio/learn-python-series-19-pymongo-part-2","https://steemit.com/utopian-io/@scipio/learn-python-series-20-pymongo-part-3"],"image":["https://cdn.utopian.io/posts/7751fd308b7b02f9b3997355b4f51f4d0ff0python_logo.png"],"moderator":{"account":"mcfarhat","time":"2018-05-02T09:23:04.890Z","pending":false,"reviewed":true,"flagged":false},"questions":{"voters":["fabiyamada"],"answers":[{"question_id":"tuts-1","answer_id":"tuts-1-a-1","user":"fabiyamada","influence":15},{"question_id":"tuts-2","answer_id":"tuts-2-a-1","user":"fabiyamada","influence":15},{"question_id":"tuts-3","answer_id":"tuts-3-a-1","user":"fabiyamada","influence":15},{"question_id":"tuts-4","answer_id":"tuts-4-a-1","user":"fabiyamada","influence":15},{"question_id":"tuts-5","answer_id":"tuts-5-a-1","user":"fabiyamada","influence":15},{"question_id":"tuts-6","answer_id":"tuts-6-a-1","user":"fabiyamada","influence":15},{"question_id":"c-1","answer_id":"c-1-a-1","user":"fabiyamada","influence":15},{"question_id":"c-2","answer_id":"c-2-a-1","user":"fabiyamada","influence":15}],"total_influence":0,"most_rated":[{"question_id":"tuts-1","answer_id":"tuts-1-a-1","influence":15,"voters":["fabiyamada"]},{"question_id":"tuts-2","answer_id":"tuts-2-a-1","influence":15,"voters":["fabiyamada"]},{"question_id":"tuts-3","answer_id":"tuts-3-a-1","influence":15,"voters":["fabiyamada"]},{"question_id":"tuts-4","answer_id":"tuts-4-a-1","influence":15,"voters":["fabiyamada"]},{"question_id":"tuts-5","answer_id":"tuts-5-a-1","influence":15,"voters":["fabiyamada"]},{"question_id":"tuts-6","answer_id":"tuts-6-a-1","influence":15,"voters":["fabiyamada"]},{"question_id":"c-1","answer_id":"c-1-a-1","influence":15,"voters":["fabiyamada"]},{"question_id":"c-2","answer_id":"c-2-a-1","influence":15,"voters":["fabiyamada"]}]},"score":100,"total_influence":15,"staff_pick":null,"staff_pick_by":null,"config":{"questions":[{"question":"How many substantial concepts does this tutorial address?","question_id":"tuts-1","answers":[{"answer":"4-5 substantial concepts covered in the tutorial.","answer_id":"tuts-1-a-1","value":10},{"answer":"2-3 substantial concepts covered in the tutorial.","answer_id":"tuts-1-a-2","value":7},{"answer":"1 substantial concept covered in the tutorial.","answer_id":"tuts-1-a-3","value":3},{"answer":"More than 5 substantial concepts covered in the tutorial.","answer_id":"tuts-1-a-4","value":0}]},{"question":"Does the title and the outline of the tutorial properly reflect the content?","question_id":"tuts-2","answers":[{"answer":"Yes, it is very clear.","answer_id":"tuts-2-a-1","value":15},{"answer":"To some extent.","answer_id":"tuts-2-a-2","value":11.5},{"answer":"The title is somewhat misleading and/or the outline is not detailed or informative enough.","answer_id":"tuts-2-a-3","value":4.5},{"answer":"Title and outline are of little or no relevance to the content of the tutorial.","answer_id":"tuts-2-a-4","value":0}]},{"question":"Did the contributor provide supplementary resources, such as code and sample files in the contribution post or a linked GitHub repository?","question_id":"tuts-3","answers":[{"answer":"Yes, exceptional supplementary resources are provided including a relevant github repo/gist.","answer_id":"tuts-3-a-1","value":15},{"answer":"Supplementary resources provided are of high relevance.","answer_id":"tuts-3-a-2","value":12},{"answer":"Contributor provides minimal supplementary resources.","answer_id":"tuts-3-a-3","value":6},{"answer":"No supplementary resources were provided.","answer_id":"tuts-3-a-4","value":0}]},{"question":"Is the tutorial part of a series?","question_id":"tuts-4","answers":[{"answer":"Yes.","answer_id":"tuts-4-a-1","value":10},{"answer":"Yes, but it is the first entry in the series.","answer_id":"tuts-4-a-2","value":7},{"answer":"No, but it works just fine as a stand-alone tutorial.","answer_id":"tuts-4-a-3","value":5},{"answer":"No.","answer_id":"tuts-4-a-4","value":0}]},{"question":"Does the tutorial contain sufficient explanatory visuals?","question_id":"tuts-5","answers":[{"answer":"Yes, the visual components of the post were adequate in quality and quantity.","answer_id":"tuts-5-a-1","value":10},{"answer":"The volume of visual components included was unnecessarily large.","answer_id":"tuts-5-a-2","value":7},{"answer":"The post lacked sufficient visualization to easily learn from the content.","answer_id":"tuts-5-a-3","value":3},{"answer":"No visualization was presented in this contribution.","answer_id":"tuts-5-a-4","value":0}]},{"question":"How unique and/or innovative are the concepts covered in the tutorial?","question_id":"tuts-6","answers":[{"answer":"This was the first time I read about the concepts covered.","answer_id":"tuts-6-a-1","value":10},{"answer":"The concepts covered were innovative and offer some usefulness.","answer_id":"tuts-6-a-2","value":7},{"answer":"I have read several similar ideas and thoughts elsewhere, but this one was of higher quality.","answer_id":"tuts-6-a-3","value":5},{"answer":"Such tutorials can be found online with great ease and the contribution add no value to the open source community.","answer_id":"tuts-6-a-4","value":0}]},{"question":"How would you describe the formatting, language and overall presentation of the post?","question_id":"c-1","answers":[{"answer":"The post is of very high quality.","answer_id":"c-1-a-1","value":10},{"answer":"The post is of decent quality, but not spectacular in any way.","answer_id":"c-1-a-2","value":7},{"answer":"The post is poorly written and/or formatted, but readable.","answer_id":"c-1-a-3","value":3},{"answer":"The post is really hard to read and the content is barely understandable.","answer_id":"c-1-a-4","value":0}]},{"question":"How would you rate the overall value of this contribution on the open source community and ecosystem?","question_id":"c-2","answers":[{"answer":"This contribution brings great and impactful value, and can be used for applications outside the specific project.","answer_id":"c-2-a-1","value":20},{"answer":"This contribution adds significant value to the open source community and ecosystem, or is of critical importance to the specific project.","answer_id":"c-2-a-2","value":16},{"answer":"This contribution adds some value to the open source community and ecosystem or is only valuable to the specific project.","answer_id":"c-2-a-3","value":8},{"answer":"This contribution adds no value to the open source community and ecosystem or the specific project.","answer_id":"c-2-a-4","value":0}]}]}}"
created2018-05-01 22:51:45
last_update2018-05-02 09:23:06
depth0
children13
last_payout2018-05-08 22:51:45
cashout_time1969-12-31 23:59:59
total_payout_value92.218 HBD
curator_payout_value31.917 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length18,075
author_reputation34,229,826,851,736
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,324,616
net_rshares24,566,891,748,544
author_curate_reward""
vote details (132)
@a-0-0 ·
Reply to this comment and I will auto upvote and resteem your post to my 36,000+ followers. @a-0-0
properties (22)
authora-0-0
permlinkre-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180501t225150958z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["a-0-0"],"app":"steemit/0.1"}
created2018-05-01 22:51:51
last_update2018-05-01 22:51:51
depth1
children0
last_payout2018-05-08 22:51:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length98
author_reputation-4,863,186,238,920
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,324,637
net_rshares0
@fabiyamada ·
$0.41
import calendar

my_cal = calendar.calendar(2018)

print(my_cal)

That would have save me a lot of times when I was asked to design calendars!! xD 
👍  ,
properties (23)
authorfabiyamada
permlinkre-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180502t014726651z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-05-02 02:49:24
last_update2018-05-02 02:49:24
depth1
children3
last_payout2018-05-09 02:49:24
cashout_time1969-12-31 23:59:59
total_payout_value0.408 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length147
author_reputation55,606,801,081,779
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,353,815
net_rshares112,040,399,411
author_curate_reward""
vote details (2)
@scipio · (edited)
$0.68
Wow! I didn't think about that! That's a very clever remark of yours, as to why `print(calendar.calendar(2018))`is useful to **designers**, saving them boatloads of time.

Coooool! :-) Your comment made my day!
👍  , ,
properties (23)
authorscipio
permlinkre-fabiyamada-re-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180502t222033032z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-02 22:20:33
last_update2018-05-02 22:20:45
depth2
children2
last_payout2018-05-09 22:20:33
cashout_time1969-12-31 23:59:59
total_payout_value0.516 HBD
curator_payout_value0.167 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length210
author_reputation34,229,826,851,736
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,523,867
net_rshares123,356,789,025
author_curate_reward""
vote details (3)
@fabiyamada ·
programmers and designers are meant to work together, I think =)
properties (22)
authorfabiyamada
permlinkre-scipio-re-fabiyamada-re-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180503t001014208z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-03 01:12:12
last_update2018-05-03 01:12:12
depth3
children1
last_payout2018-05-10 01:12:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length64
author_reputation55,606,801,081,779
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,543,101
net_rshares0
@james1122 ·
 Awesome post!! Keep it up and check out [THIS POST](https://steemit.com/life/@cryptopaparazzi/chapter-one-let-there-be-the-man-and-there-was-a-man-let-there-be-a-woman-and-there-was-sex) as well as I have something similar. 
properties (22)
authorjames1122
permlinkre-learn-python-series-21-handling-dates-and-time-part-1-20180502t195549
categoryutopian-io
json_metadata""
created2018-05-02 19:55:51
last_update2018-05-02 19:55:51
depth1
children0
last_payout2018-05-09 19:55:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length225
author_reputation-1,569,261,196,247
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,504,778
net_rshares0
@james1122 ·
 Awesome post!! Keep it up and check out [THIS POST](https://steemit.com/life/@cryptopaparazzi/chapter-one-let-there-be-the-man-and-there-was-a-man-let-there-be-a-woman-and-there-was-sex) as well as I have something similar. 
properties (22)
authorjames1122
permlinkre-learn-python-series-21-handling-dates-and-time-part-1-20180502t220734
categoryutopian-io
json_metadata""
created2018-05-02 22:07:33
last_update2018-05-02 22:07:33
depth1
children0
last_payout2018-05-09 22:07:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length225
author_reputation-1,569,261,196,247
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,522,272
net_rshares0
@mcfarhat ·
$0.40
Thank you for the beautiful work !

----------------------------------------------------------------------
Need help? Write a ticket on https://support.utopian.io.
Chat with us on [Discord](https://discord.gg/uTyJkNm).

**[[utopian-moderator]](https://utopian.io/moderators)**
👍  
properties (23)
authormcfarhat
permlinkre-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180502t093112936z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-05-02 09:31:15
last_update2018-05-02 09:31:15
depth1
children1
last_payout2018-05-09 09:31:15
cashout_time1969-12-31 23:59:59
total_payout_value0.398 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length276
author_reputation150,651,671,367,256
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,406,802
net_rshares109,765,467,443
author_curate_reward""
vote details (1)
@scipio ·
$1.76
Thank you too! :-)
👍  ,
properties (23)
authorscipio
permlinkre-mcfarhat-re-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180502t222107576z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-02 22:21:06
last_update2018-05-02 22:21:06
depth2
children0
last_payout2018-05-09 22:21:06
cashout_time1969-12-31 23:59:59
total_payout_value1.323 HBD
curator_payout_value0.433 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length18
author_reputation34,229,826,851,736
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,523,933
net_rshares316,079,693,761
author_curate_reward""
vote details (2)
@raftaar ·
Great informative.We do not know python resources very well.Thank you for giving us such news.Great work done.Keep it up,God bless you.
properties (22)
authorraftaar
permlinkre-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180502t103611595z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-02 10:36:09
last_update2018-05-02 10:36:09
depth1
children0
last_payout2018-05-09 10:36:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length135
author_reputation8,901,986,322
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,415,756
net_rshares0
@sabbir1213 ·
We get very less articles about Python, so thank you for taking such a nice Decision for us.
properties (22)
authorsabbir1213
permlinkre-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180502t000146801z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-02 00:01:51
last_update2018-05-02 00:01:51
depth1
children0
last_payout2018-05-09 00:01:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length92
author_reputation2,006,363,477,841
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,332,845
net_rshares0
@utopian-io ·
#### Hey @scipio
We're already looking forward to your next contribution!

##### Utopian Witness!
<a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for Utopian Witness!</a> We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.

**Want to chat? Join us on Discord https://discord.gg/h52nFrV**
properties (22)
authorutopian-io
permlinkre-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180505t152609188z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["scipio"],"links":["https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1","https://discord.gg/h52nFrV"],"app":"steemit/0.1"}
created2018-05-05 15:26:09
last_update2018-05-05 15:26:09
depth1
children0
last_payout2018-05-12 15:26:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length437
author_reputation152,955,367,999,756
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,041,616
net_rshares0
@zerocoolrocker ·
Nice post @scipio!  :) You should also mention datetime.timedelta (probably you are goin do so in the next post) :) it's really useful to make arithmetic operations with dates
properties (22)
authorzerocoolrocker
permlinkre-scipio-learn-python-series-21-handling-dates-and-time-part-1-20180502t084830051z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["scipio"],"app":"steemit/0.1"}
created2018-05-02 08:19:00
last_update2018-05-02 08:19:00
depth1
children0
last_payout2018-05-09 08:19:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length175
author_reputation3,837,192,988
root_title"Learn Python Series (#21) - Handling Dates and Time Part 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,396,938
net_rshares0