datetime - Python fraction of seconds -


What is the best way to handle each other in Python? The Dataim library is excellent, but as far as I can tell it can not handle fewer seconds than any unit.

In the datetime module, the smallest resolution of the microscope occurs in day-time, time and timetable sections:

  & gt; & Gt; & Gt; From date time import date times, timelatta & gt; & Gt; & Gt; Now = datetime.now ()> gt; & Gt; & Gt; Now datetime.datetime (2009, 12, 4, 23, 3, 27, 343000) & gt; & Gt; & Gt; Now. If you want to display a day-long period with partial seconds, then just enter a decimal point and bar the zero behind:  
 < Code> & gt; & Gt; & Gt; Now. Strftime ("% Y-% m-% d% H:% M:% S.% f"). Rstrip ('0') '2009-12-04 23: 03: 27.343'  

Datetime and time classes only accept integer inputs and the hours, minutes and seconds are from 0 to 59 Must be Between and Microseconds should be between 0 and 99 99 99. However, the TimedData class will accept floating point values ​​with the numerators and arithmetic all the appropriate modules for you:

  & gt; & Gt; & Gt; Span = timedelta (secs = 3662.567) & gt; & Gt; & Gt; The original components of timetighttimes are days, seconds and microseconds (0, 3662, 567000 above), but the constructor will also accept milliseconds, hour and week all input can be integers or floats (positive or negative). All logic is converted to base units and then normalized so that 0 & lt; = Sec & lt; 60 and 0 & lt; = Microsoft & lt; 1000000  

You can add or subtract spreads for a datetime or time instance or any other period. Make fool around it, you probably can easily come up with some functions or classes so that's what you want. You can probably process all your dates / time using relative timing examples for a certain date time, basetime = datetime (2000,1,1,0,0,0,0) Say, then change in a date time or time example for performance or storage.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -