dwb2023 commited on
Commit
ee66c5b
·
verified ·
1 Parent(s): 55c3835

Update file_utils.py

Browse files
Files changed (1) hide show
  1. file_utils.py +3 -3
file_utils.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  from magika import Magika
3
- import time
4
 
5
  def validate_file_types(directory):
6
  m = Magika()
@@ -21,8 +21,8 @@ def validate_file_types(directory):
21
 
22
  def get_file_summary(file_path, file_type):
23
  size = os.path.getsize(file_path)
24
- creation_date = time.ctime(os.path.getctime(file_path))
25
- modification_date = time.ctime(os.path.getmtime(file_path))
26
  return {
27
  "name": os.path.relpath(file_path),
28
  "type": file_type,
 
1
  import os
2
  from magika import Magika
3
+ import datetime
4
 
5
  def validate_file_types(directory):
6
  m = Magika()
 
21
 
22
  def get_file_summary(file_path, file_type):
23
  size = os.path.getsize(file_path)
24
+ creation_date = datetime.datetime.utcfromtimestamp(os.path.getctime(file_path)).strftime('%Y-%m-%d %H:%M:%S UTC')
25
+ modification_date = datetime.datetime.utcfromtimestamp(os.path.getmtime(file_path)).strftime('%Y-%m-%d %H:%M:%S UTC')
26
  return {
27
  "name": os.path.relpath(file_path),
28
  "type": file_type,