DateType: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
(Added basic description of DateType)
 
(fixed erroneous use of BBCode)
 
Line 2: Line 2:


In Python, properties of this value will be returned as PyTime objects.  It can be converted to a timestamp using float() or int():
In Python, properties of this value will be returned as PyTime objects.  It can be converted to a timestamp using float() or int():
[code]
<pre>
lpDate = track.DatePlayed
lpDate = track.DatePlayed
timestamp = float(lpDate)  # or int(lpDate)
timestamp = float(lpDate)  # or int(lpDate)
dateobj = datetime.utcfromtimestamp(timestamp)
dateobj = datetime.utcfromtimestamp(timestamp)
[/code]
</pre>

Latest revision as of 19:46, 15 April 2012

DateType is a date-identifier. At base, it is a floating-point number expressing seconds since the epoch (nominally 1-Jan-1970 0:00 UTC).

In Python, properties of this value will be returned as PyTime objects. It can be converted to a timestamp using float() or int():

lpDate = track.DatePlayed
timestamp = float(lpDate)  # or int(lpDate)
dateobj = datetime.utcfromtimestamp(timestamp)