themehmi commited on
Commit
ac0bdba
·
verified ·
1 Parent(s): 899d8a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -65,10 +65,11 @@ marked_names = set()
65
  def mark_attendance(name):
66
  if name not in marked_names:
67
  marked_names.add(name)
68
- # Apply the IST timezone here
69
- now = datetime.now(IST)
70
  current_date = now.strftime("%Y-%m-%d")
71
- current_time = now.strftime("%H:%M:%S")
 
 
72
 
73
  conn = sqlite3.connect(DB_FILE)
74
  cursor = conn.cursor()
@@ -200,7 +201,7 @@ def register():
200
  new_encodings.append(encoding)
201
 
202
  # Save image
203
- timestamp = datetime.now().strftime("%Y%m%d_%H%M%S%f")
204
  image_path = person_dir / f"photo_{idx:02d}_{timestamp}.jpg"
205
  cv2.imwrite(str(image_path), frame)
206
  saved_count += 1
 
65
  def mark_attendance(name):
66
  if name not in marked_names:
67
  marked_names.add(name)
68
+ now = datetime.now(IST) # Assuming you kept the IST update
 
69
  current_date = now.strftime("%Y-%m-%d")
70
+
71
+ # CHANGE IS HERE: Use %I for 12-hour clock and %p for AM/PM
72
+ current_time = now.strftime("%I:%M:%S %p")
73
 
74
  conn = sqlite3.connect(DB_FILE)
75
  cursor = conn.cursor()
 
201
  new_encodings.append(encoding)
202
 
203
  # Save image
204
+ timestamp = datetime.now(IST).strftime("%Y%m%d_%H%M%S%f")
205
  image_path = person_dir / f"photo_{idx:02d}_{timestamp}.jpg"
206
  cv2.imwrite(str(image_path), frame)
207
  saved_count += 1