Commit 767f4ae9 authored by Georgios Dagkakis's avatar Georgios Dagkakis

use strftime in plugin

parent 8780b4d6
...@@ -10,20 +10,6 @@ class GetCurrentTime(plugin.InputPreparationPlugin): ...@@ -10,20 +10,6 @@ class GetCurrentTime(plugin.InputPreparationPlugin):
currentTime=data['general'].get('currentDate',None) currentTime=data['general'].get('currentDate',None)
if not currentTime: if not currentTime:
currentTime=datetime.datetime.now() currentTime=datetime.datetime.now()
year=currentTime.year
month=currentTime.month
day=currentTime.day
minute=currentTime.minute
hour=currentTime.hour
minute=currentTime.minute
second=currentTime.second
dateFormat=data['general'].get('dateFormat','%Y/%m/%d %H:%M') dateFormat=data['general'].get('dateFormat','%Y/%m/%d %H:%M')
if dateFormat=='%Y/%m/%d %H:%M:%S': data['general']['currentDate']=currentTime.strftime(dateFormat)
currentTimeString=str(year)+'/'+str(month).zfill(2)+'/'+str(day).zfill(2)+' '+str(hour).zfill(2)+':'+str(minute).zfill(2)+':'+str(second).zfill(2)
elif dateFormat=='%Y/%m/%d %H:%M':
currentTimeString=str(year)+'/'+str(month).zfill(2)+'/'+str(day).zfill(2)+' '+str(hour).zfill(2)+':'+str(minute).zfill(2)
elif dateFormat=='%Y/%m/%d':
currentTimeString=str(year)+'/'+str(month).zfill(2)+'/'+str(day).zfill(2)
print currentTimeString
data['general']['currentDate']=currentTimeString
return data return data
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment