Skip to content

Commit 8df7bc6

Browse files
committed
updates
1 parent 65f8b80 commit 8df7bc6

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

‎week-06/datetime/examples/datetime_aware_to_sqlite.py‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def convert_datetime(ts):
2020

2121
sqlite3.register_adapter(datetime.datetime, adapt_datetime)
2222
sqlite3.register_converter('timestamp', convert_datetime)
23-
# sqlite3.register_converter(datetime.datetime, convert_datetime)
2423

2524
input_values = []
2625

@@ -29,11 +28,7 @@ def convert_datetime(ts):
2928
us_pacific_tz = pytz.timezone('US/Pacific')
3029
input_values.append([datetime.datetime(2019,11,1, tzinfo=us_pacific_tz)])
3130

32-
# t1 = datetime.datetime.now()
33-
# t2 = datetime.datetime.now()
34-
3531
conn = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES)
36-
# conn = sqlite3.connect(":memory:")
3732

3833
cursor = conn.cursor()
3934

‎week-06/datetime/slides/index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ <h2><a href="http://en.wikipedia.org/wiki/UTC">UTC: Coordinated
8585
<section class="slide">
8686
<h2><a target="_blank" href="http://en.wikipedia.org/wiki/Unix_time">UNIX time</a></h2>
8787
<ul>
88-
<li>UNIX time is represented as the number of seconds from one point in time known as the Epoch, defined to be 00:00 (TZ?) January 1, 1970 UTC, not counting leap seconds
88+
<li>UNIX time is represented as the number of seconds from one point in time known as the Epoch, defined to be 00:00 UTC January 1, 1970, not counting leap seconds
8989
<li>Note that UNIX time is based on another time standard
9090
<li>On 32 bit OSes which store time as a signed 32-bit integer, the largest value that can be stored is 03:14:07 UTC on Tuesday, 19 January 2038. One second afterwards, time overflows back to zero. This is known as the Y2038 problem.
9191
<li>On 64 bit machines, the largest time which can be represented is in the year 292 billion, at which time our universe is predicted to not exist
@@ -188,7 +188,7 @@ <h2>two types of datetimes - naive and aware</h2>
188188
<p>Timezone is specified with the tzinfo attribute, through the constructor: datetimes are immutable
189189
<p>Change the timezone or another attribute with the replace(*args, **kwargs) method to create a new object with all the same attributes except those specified
190190
<p>tzinfo is expected to be a subclass of datetime.tzinfo
191-
<p>However, datetime.tzinfo is an abstract base class, which means you'll need to define your own subclass (fraught with peril) or install the pytz package
191+
<p>However, datetime.tzinfo is an abstract base class, which means you'll need to define your own subclass (filled with peril) or install the pytz package
192192
<p>pytz is based on the <a target="_blank" href="http://en.wikipedia.org/wiki/Tz_database">Olson database</a>, a reference database of the world's timezones.
193193
</section>
194194

@@ -242,7 +242,7 @@ <h2>time calculations</h2>
242242
<section class="slide">
243243
<h2>Storing datetimes</h2>
244244
<p>Try to deal in UTC as much as possible. Do not depend on the machine's interpretation of local time.
245-
<p>For instance, my datetime.now() on my Mac will return a naive datetime containing the local time. Alternatively:
245+
<p>For instance, datetime.now() on my Mac will return a naive datetime containing the local time. Alternatively:
246246
<pre><code>
247247
# return the current time as an aware datetime in UTC:
248248
datetime.datetime.now(pytz.UTC)

0 commit comments

Comments
 (0)