add wochen, monate,stunden, jahre
This commit is contained in:
		
							parent
							
								
									bc15edfa11
								
							
						
					
					
						commit
						b5f20c207e
					
				@ -13,7 +13,6 @@ import time
 | 
				
			|||||||
from PIL import Image,ImageDraw,ImageFont
 | 
					from PIL import Image,ImageDraw,ImageFont
 | 
				
			||||||
import traceback
 | 
					import traceback
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
logging.basicConfig(level=logging.DEBUG)
 | 
					logging.basicConfig(level=logging.DEBUG)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#Define Display
 | 
					#Define Display
 | 
				
			||||||
@ -63,12 +62,12 @@ def init_monitor():
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    # Drawing on the Horizontal image
 | 
					    # Drawing on the Horizontal image
 | 
				
			||||||
    logging.info("1.Drawing on the Horizontal image...") 
 | 
					    logging.info("1.Drawing on the Horizontal image...") 
 | 
				
			||||||
    drawblack.text((4, 0), 'Noch: ' + str(duration.days), font = font16, fill = 0)
 | 
					    drawblack.text((4, 0), 'Lieber Reinhold, auf dich warten noch: ' + str(duration.days) + " Tage", font = font16, fill = 0)
 | 
				
			||||||
    drawblack.text((4, 16), 'Oder: ' + str(duration.seconds), font = font16, fill = 0)
 | 
					    drawblack.text((4, 16), 'Oder ' + str(round(duration.days / 7,3)) + " Wochen", font = font16, fill = 0)
 | 
				
			||||||
    drawblack.text((4, 32), ' ', font = font16, fill = 0)
 | 
					    drawblack.text((4, 32), 'Oder ', + str(round(duration.days / 30,3)) + " Monate", font = font16, fill = 0)
 | 
				
			||||||
    drawblack.text((4, 48), ' ', font = font16, fill = 0)
 | 
					    drawblack.text((4, 48), 'Oder ', + str(duration.days * 24) + " Stunden", font = font16, fill = 0)
 | 
				
			||||||
    drawblack.text((4, 64), ' ', font = font16, fill = 0)
 | 
					    drawblack.text((4, 64), 'Oder ', + str(duration.days / 365) + " Jahre", font = font16, fill = 0)
 | 
				
			||||||
    drawblack.text((4, 80), str(ruhestand.strftime("%A %B %d.%m.%Y")), font = font16, fill = 0)
 | 
					    drawblack.text((4, 80), "Bis du am " + str(ruhestand.strftime("%A %B %d.%m.%Y")), font = font16, fill = 0)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
 | 
					    epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					import time
 | 
				
			||||||
 | 
					import datetime
 | 
				
			||||||
 | 
					import locale
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					loc = locale.getlocale()
 | 
				
			||||||
 | 
					print (loc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from datetime import datetime, timedelta, date
 | 
				
			||||||
 | 
					# Zwei datetime-Objekte erstellen
 | 
				
			||||||
 | 
					# from datetime import date
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					start_time = date.today() 
 | 
				
			||||||
 | 
					print(start_time.strftime("%d.%m.%Y"))
 | 
				
			||||||
 | 
					ruhestand = date(2025, 6, 10) 
 | 
				
			||||||
 | 
					# Zeitdelta berechnen 
 | 
				
			||||||
 | 
					duration = ruhestand - start_time 
 | 
				
			||||||
 | 
					print("Tage: " + str(duration.days)) 
 | 
				
			||||||
 | 
					print("Wochen: " + str(round(duration.days / 7,3))) 
 | 
				
			||||||
 | 
					print("Monate: " + str(round(duration.days / 30,3))) 
 | 
				
			||||||
 | 
					print("Jahre: " + str(round(duration.days / 365,3))) 
 | 
				
			||||||
 | 
					print("Stunden: " + str(duration.days *24)) 
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user