How get simple 'today' date string ?
#1
I know there is a lot of online doc about python and dates, like this official doc page. but I'm asking this to you because I'm new to Python and because Python version declared from addon.xml is as low as 2.1.0. ...

What's the right way, in python 2.1 to get the current date and create a simple string like "2013/9/24" ?
Reply
#2
python 2.1.0 is our internal "version".
we actually use python2.6 and some use python2.7

Simple search:
http://www.saltycrane.com/blog/2008/06/h...d-time-in/
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
So 2.6 is the 'safe' version ?
I tried the method from the lilnk under windows 8 and all works, must I test againsta all supported platoform or can I suppose it works ?
Reply
#4
if it works for you it should work for others as windows (for now) uses 2.6.x
once done create a thread for others to test you plugin and watch feedback come in if some experience problems.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
To avoid possible locale issues (not sure if the timezone etc. is always correct in the python environment, especially on embedded hardware like raspberry pi, OpenElec or Android) I would suggest using XBMC InfoLabels for the date.

If you just need the date of today (as string), you can use something like:
PHP Code:
today xbmc.getInfoLabel('System.Date(dd.mm.yyyy)')
today_other_format xbmc.getInfoLabel('System.Date(yyyy/mm/dd)'

Just have a look to the available infolabels and their format options.
My GitHub. My Add-ons:
Image
Reply
#6
Thanks.

I'm testing on android, windows, linux, and raspberry.

If everything works, I'll keep date function; they're more readable, just this.
Reply

Logout Mark Read Team Forum Stats Members Help
How get simple 'today' date string ?0