You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
This website is a work–in–progress; it is a place where I share my thoughts, ideas, and projects with the world. Thanks for stopping by! I am a software engineer, writer, and speaker, and I am passionate about technology, open source, and education. Previously, I was very interested in photography and music as well. I am known mostly for my open–source creations, such a Requests and Pipenv. In the
datetime モジュールは Python の標準ライブラリの中でも、使用頻度が高い割に罠が多かったり使い方が難しかったりする、あまりイケてないモジュールだと個人的に思っています。 そんな datetime モジュールですが、 Python 2 のプロジェクトを Python 3 に移行した時に大分コードを整理できてちょっと感動したので紹介しておきます。 unixtime との相互変換 unixtime から datetime.datetime への変換は、 ローカルタイムなら.fromtimestamp() で、 UTC なら .utcfromtimestamp() 関数で行います。 >>> import time >>> from datetime import datetime >>> now = time.time() >>> now 1415542873.099776 >>>
What?¶ Arrow is a Python library that offers a sensible, human-friendly approach to creating, manipulating, formatting and converting dates, times, and timestamps. It implements and updates the datetime type, plugging gaps in functionality, and provides an intelligent module API that supports many common creation scenarios. Simply put, it helps you work with dates and times with fewer imports and
Project link: https://github.com/closeio/ciso8601 Sometimes it's the little things that make web apps faster. We noticed that loading leads and opportunity view pages in Close wasn't as fast as we wanted it to be in some cases, so we pulled up the profiler. To our surprise, a large portion of time was spent parsing date times, sometimes up to a second. How did this happen? We serialize certain lea
MySQL-python(MySQLdb)を上げたら、今まで通ってたテストでwarningが出るようになりました。 MySQLdb/times.pyで以前は def format_TIMESTAMP(d): return d.strftime("%Y-%m-%d %H:%M:%S") こうなっていたものが、 def format_TIMESTAMP(d): return d.isoformat(" ") こうなったのが原因らしいのだけど、Changelogを見てもそれらしい表記がないので少し経緯を追ってみました。 この変更で何が問題になったかというと、 >> import datetime, pytz >>> datetime.datetime.now(pytz.utc).isoformat(' ') # aware '2013-06-27 01:50:16.156481+00:00' >
「Pythonの日付処理とTimeZone」を書いた後、Twitterで指摘をもらっていたのを遅ればせながら検証したので、改めてエントリを起こしてみました。 Pythonの日付処理とTimeZone http://t.co/KK1B5Fot0V datetime を tzinfo 付きで生成する場合は pytz.tzinfo.normalize しないと DST 境界を超えるところで存在しない時刻を作りますよ — Jun Omae⁽⁶⁶ʲ⁵⁾ (@jun66j5) June 22, 2013 @jun66j5さんありがとうございました。 このへんの背景はpytzのサイトにありますが、そもそもサマータイムに馴染みがないのでどうあるべきかがしっくりきません。 標準時と夏時間の切り替わり ここでは、ニューヨークが属するTimeZoneを例に話を進めます。まずは基本的な用語の整理から。 DST …
Working with Dates A set of examples working with Python date and time functions, including formatting dates, date calculations, and other common date tasks. First off, all examples use the following import, any additional imports needed will be shown with the example. from datetime import datetime Creating Date Objects Typically the first thing you want to do is create a Python date object, eithe
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く