Latest Uploads
Invasion V ... prototype

rychan

Invasion V ... Prototype

rychan

Shields 64x64

Pakz

Ffs_Spam

Jayenkai

Hives Screen shot

rychan

Rpg Potion Sprites

Pakz

Code Snippets > Timing ( Created 26 March 2016 | Last Edited 26 March 2016)

naturaltime.py by HoboBen | No Votes
human readable time deltas for Python
Written in
Python
Given a Python datetime, generate a nice helpful string, relative to right now, like:

'tomorrow at 7:00 am'
'just now'
'about 42 minutes ago'

-->

Gist

Latest Comments

Posted : Saturday, 26 March 2016, 04:08
Jayenkai


Looks useful.
I'm surprised something like that isn't already part of the whole datetime thing. From the look of your code, datetime seems fairly comprehensive.

Homepage : http://AGameAWeek.com
Posted : Sunday, 27 March 2016, 01:19
HoboBen


Datetimes in python, and in particular timedeltas, are super super handy

There is this module which can humanize all sorts of things for different languages, but it was overkill for me!

https://pypi.python.org/pypi/humanize

-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 648|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Latest Posts
Any Feature Requests?
Kuron Fri 23:09
More Monkey Madness - With Ducks
therevillsgames Fri 20:23
Arms on Switch
Jayenkai Fri 18:30
Time for a new Android Test Doohickey
Jayenkai Fri 09:26
CSS-Me-Do - SoCoder2
Jayenkai Fri 06:28
Pillowcases for kids!
rockford Thu 16:15
Manchester Arena Explosion
Jayenkai Thu 02:04
Buy Zelda
spinal Wed 11:31
Family
Jayenkai Wed 04:06
RIP - Sir Roger Moore
rockford Tue 15:56
More

Latest Items
Showcase : Hives
zzoom Fri 16:10
Dev-Diary : My Journey into NES Development
rychan Thu 12:31
Showcase : Flappadiddle
Jayenkai Sun 14:39
Snippet : QFind
Jayenkai Sun 13:02
Showcase : Tiny Blocks
Jayenkai Sun 04:08
Showcase : Read Error A
rychan Fri 05:13
Blog : All my makes!
Jayenkai Tue 05:48
Showcase : Infinitron
rychan Mon 18:03
Showcase : Quadoban
rskgames Fri 10:11
Blog : My Arduino experience.
steve_ancell Wed 17:02
Showcase : Roguelike Explorer
Pakz Fri 06:59
News : Newsletter #311
Jayenkai Thu 17:27
Link : Super Shapes Exploration Kit
Andy_A Thu 11:09
Dev-Diary : Sensitive - Arduboy!
rychan Thu 17:27
Snippet : Skylines
steve_ancell Tue 14:25
More

Who's Online
Kuron
Fri, at 23:09
Evil Roy Ferguson
Fri, at 20:47
therevillsgames
Fri, at 20:23
rskgames
Fri, at 19:28
Jayenkai
Fri, at 18:41
9572AD
Fri, at 18:10
steve_ancell
Fri, at 18:04
rockford
Fri, at 16:34
zzoom
Fri, at 16:14
Pakz
Fri, at 15:20
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.