Commit 4a185c3e authored by Adrien Simon's avatar Adrien Simon
Browse files

ajout de decode pour les timestamp

parent b130a933
from datetime import datetime
def string_decode(chaine):
return chaine.encode('latin1').decode('utf8')
\ No newline at end of file
return chaine.encode('latin1').decode('utf8')
def timestamp_decode(date_ts):
date_ts = int(str(date_ts)[:-3]) # on enleve les millisecondes
date_dt = datetime.fromtimestamp(date_ts) # conversion en date yyyy-mm-dd
time_dt = str(date_dt)[-8:] # on prend les 8 derniers caracteres pour recup l'heure
date_dt = date_dt.strftime('%d-%m-%Y') + " " + time_dt # on concatene la date en dd-mm-yyyy et l'heure
return date_dt
......@@ -15,7 +15,6 @@ def getname(name):
def getfile(name):
originpath = os.getcwd()
path = os.getcwd() + "/messages/inbox/"
os.chdir(path)
......
......@@ -13,7 +13,7 @@ if __name__ == "__main__":
# choose action to do
choice = 0
while choice != 3:
choice = int(input("\n1 - Afficher les messages\n2 - Afficher les participants\n3- Quitter l\'application\n"))
choice = int(input("\n1 - Afficher les messages\n2 - Afficher les participants\n3 - Quitter l\'application\n"))
if choice == 1:
print(data)
if choice == 2:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment