If You want to return only year from your datetime field then do like this:
from tools import DEFAULT_SERVER_DATETIME_FORMAT
year = datetime.datetime.strptime(your_date, DEFAULT_SERVER_DATETIME_FORMAT).strftime("%Y")
Thank You, Serpent Consulting Services Pvt. Ltd.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 5/15/13, 12:12 PM|
|Seen: 2224 times|
|Last updated: 3/16/15, 8:10 AM|