Hi C4W.
Just thought I'd use this to convert a Unix timestamp to a visual date, purely for something I'm debugging in one of my own plugins - when I noticed that's not one of the options?
(Unless, there's a %code for the full timestamp but I can't find one?)
Peter
Convert timestampt to date/time?
- Colorado4Wheeler
- Posts: 2794
- Joined: Mon Jul 20, 2009 10:48 am
- Location: Colorado
Re: Convert timestampt to date/time?
Well, the date format is Python but it's just reading a string, so as long as you specify the format, in Python notation, it should covert.
My Modest Contributions to Indigo:
HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy
Check Them Out Here
HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy
Check Them Out Here
Re: Convert timestampt to date/time?
But that’s the problem, there is no date notation for time.time() that strftime() etc supports?
If I’d used time.strftime(%y %m %d, time.time()) when creating my plugin then I could use your plugin to convert %y %m %d to something else.
But I used time.time() in my plugin, purely for counting seconds elapsed, so I didn’t need to format it in the plugin when I stored it in a state.
Now I want to temporarily (without recoding states) see the h
s value of that timestamp?
Sent from my iPhone using Tapatalk Pro
If I’d used time.strftime(%y %m %d, time.time()) when creating my plugin then I could use your plugin to convert %y %m %d to something else.
But I used time.time() in my plugin, purely for counting seconds elapsed, so I didn’t need to format it in the plugin when I stored it in a state.
Now I want to temporarily (without recoding states) see the h
Sent from my iPhone using Tapatalk Pro
Re: Convert timestampt to date/time?
Code: Select all
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())Code: Select all
time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time()))I am in the UK.. delta of 1 hour is due to DST
Karl
Last edited by kw123 on Sun Apr 08, 2018 9:54 am, edited 1 time in total.
Re: Convert timestampt to date/time?
I know how to do it in code, I just thought it would a) be in the DE plugin already and b) because it isn’t, be a useful suggestion.
Seems not.
Sent from my iPhone using Tapatalk Pro
Seems not.
Sent from my iPhone using Tapatalk Pro
- Colorado4Wheeler
- Posts: 2794
- Joined: Mon Jul 20, 2009 10:48 am
- Location: Colorado
Re: Convert timestampt to date/time?
It is and I'll look to add that. DE is a mess on my end right now with so many changes so you won't see that change for a while, that's why I was trying to see if there was a way to do it with what DE already does.howartp wrote:I know how to do it in code, I just thought it would a) be in the DE plugin already and b) because it isn’t, be a useful suggestion.
I didn't understand that you were wanting to drop to a shell to do it, I thought it was in Unix format and sitting somewhere in Indigo already, then it's a matter of converting the format.
My Modest Contributions to Indigo:
HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy
Check Them Out Here
HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy
Check Them Out Here
Re: Convert timestampt to date/time?
Hehe, I don't want to drop to a shell, and it is in Unix format sitting in Indigo already...Colorado4Wheeler wrote:It is and I'll look to add that. DE is a mess on my end right now with so many changes so you won't see that change for a while, that's why I was trying to see if there was a way to do it with what DE already does.howartp wrote:I know how to do it in code, I just thought it would a) be in the DE plugin already and b) because it isn’t, be a useful suggestion.
I didn't understand that you were wanting to drop to a shell to do it, I thought it was in Unix format and sitting somewhere in Indigo already, then it's a matter of converting the format.
Never mind, I've sorted my plugin issue anyway - it will be good to add to DE when you get to it but no urgency.