Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python time range monthly

>>> from datetime import datetime, timedelta
>>> from collections import OrderedDict
>>> dates = ["2014-10-10", "2016-01-07"]
>>> start, end = [datetime.strptime(_, "%Y-%m-%d") for _ in dates]
>>> OrderedDict(((start + timedelta(_)).strftime(r"%b-%y"), None) for _ in xrange((end - start).days)).keys()
['Oct-14', 'Nov-14', 'Dec-14', 'Jan-15', 'Feb-15', 'Mar-15', 'Apr-15', 'May-15', 'Jun-15', 'Jul-15', 'Aug-15', 'Sep-15', 'Oct-15', 'Nov-15', 'Dec-15', 'Jan-16']
Comment

PREVIOUS NEXT
Code Example
Python :: dd-mm-yy to yyyy-mm-dd in python 
Python :: qtile: latest development version 
Python :: how many perfect squared lie between 1 and 400 
Python :: python turn seconds into zulu time 
Python :: dfs and bfs in python 
Python :: aiml python install 
Python :: fibbonacci python 
Python :: python fibonacci sequence while loop 
Python :: auto instagram login 
Python :: how to check if a column exists before alter the table 
Python :: atan of number python 
Python :: xlabel font size python latex 
Python :: python tokenize sentence italian spacy 
Python :: python date_end-date_Start in seconds 
Python :: django force download file 
Python :: get node name dynamo revit 
Python :: how to join models from another app 
Python :: pandas get only entries that match list 
Python :: django database specify schema 
Python :: le %s 
Python :: python laplace expansion 
Python :: # sort the dictionary 
Python :: python deconstruct tuple 
Python :: Specifying your data type 
Python :: BIDS extract JSON data 
Python :: Math Module asin() Function in python 
Python :: python occ display point 
Python :: python to uml 
Python :: difference between iglob() and glob() functions in python 
Python :: Python NumPy atleast_3d Function Syntax 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =