Site Sponsors:
EzLog for Python 
Originally written in C/C++, how could I not share this one?


from datetime import datetime as zdatetime
from email import utils

class EzLog():

def _hack(self, message):
znow =
znow = utils.localtime(znow)
self.local_date = znow.strftime(format=self.LFORMAT)
self.message = str(message)

def Create(recipe):
import sys
words = sys.argv[1:]
message = ''
for word in words:
if len(message) is not 0:
message += ' '
message += word
return recipe(message)

def __init__(self, message):
""" Taking care of beez-nice """
self.LFORMAT = '%Y/%m/%d: %H.%M.%S (LOCAL)'
self.UFORMAT = '%Y/%m/%d: %H.%M.%S [%z]'

def __repr__(self):
return self.local_date + "\t" + self.message + "\n"

def __str__(self):
return repr(self)

def hack(self, message):
""" Update the time, as well as the message """

def isNull(self):
return len(self.message) == 0

if __name__ == '__main__':
entry = EzLog.Create()
with open("./logger.log", "a") as fp:
if entry.isNull():
entry.message = "This is a test"



[ view entry ] ( 234 views )   |  permalink  |  related link
Passable 'RFC 2822' Localtime in Python 3 
Time ... you would think that it would be easy to express on a computer... What could be more natural than counting the number of seconds?

Yet after decades of computerization, we are still 'haggling over the proper way to express time!

Here is what we cobbled together while creating a client-side API for the new, R&D, AboutTime HTML Server:

import datetime
from email import utils

zdt = # Omits the GMT Offset
zlocal = utils.localtime(zdt) # Adds the official GMT Offset
localtime = utils.format_datetime(zlocal) # RFC 2822-ish

... and here is the output:

/usr/bin/python3.5 .../Python3/AboutTime_API/
2017-12-13 08:02:20.817119
2017-12-13 08:02:20.817119-05:00
Wed, 13 Dec 2017 08:02:20 -0500

Then, as one becomes interested in Zulu / Server Time:

zdt = datetime.datetime.utcnow() # Omits the GMT Offset
zulutime = utils.format_datetime(zdt) # RFC 2822-ish


2017-12-13 13:02:20.817251
Wed, 13 Dec 2017 13:02:20 -0000

For those who would like to use an enumerated set of timezones:
from datetime import timezone
znow =

We can also:
utc_date = znow.strftime(format='%Y-%m-%d %H:%M:%S [%z]')

Sharing is caring!


Google candy: GMT, UTC, Epoch time, conversion, email, RFC 822

[ view entry ] ( 158 views )   |  permalink  |  related link
New Project: AboutTime ... for the 'Web! 
The work on cleaning up those awful WikiQuotes lead me to coin the word 'Quotie,' as well as to pop-out a web UI.

Dedicated to cleaning up such a horrid morass, this week the brain-wave was to refactor that C.R.U.D so as to support my original time-tracking and invoicing efforts.

Known as "AboutTime," the name was originally applied to an on-line Applet.

Created before I served as the Consulting Technical Section Leader at the United States Electronic Proving Ground (EPG/DTC) I used the Applet to allow my section & I to better manage their time at Fort Huachuca.

Today's R&D Release

Migrated to a stand-alone desktop application after Java's Applet security 'sandbox' melt-down, this week's return to the 'Web marks our official return to maintaining a truly collaborative, time-tracking, tool set.

(zDesktop - free on Sourceforge)

Our plans are to merge the 'Desktop and 'Web together so as to create a free & open logging / time management tool.

If you would like to support our efforts, then feel free to purchase a copy of our new book, or one of our on-line training offerings?

Sharing is caring!

[ view entry ] ( 238 views )   |  permalink  |  related link

<<First <Back | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Next> Last>>