adil9858 commited on
Commit
9dc61eb
·
verified ·
1 Parent(s): caef5b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
2
  import pandas as pd
3
  import requests
4
  from datetime import datetime
 
5
 
6
  # SheetDB API Endpoint for Timecard Data
7
  SHEETDB_API_URL_TIMECARD = "https://sheetdb.io/api/v1/jsh4nri7t8rko" # Replace with your SheetDB API URL for timecard
@@ -35,7 +36,18 @@ def load_data():
35
  # Save timecard data to SheetDB
36
  def save_data(employee_name, project_name, project_code, hours, notes):
37
  # Automatically set the date to the current date
38
- formatted_date = datetime.today().isoformat()
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  new_entry = {
41
  "Employee Name": employee_name,
 
2
  import pandas as pd
3
  import requests
4
  from datetime import datetime
5
+ import pytz
6
 
7
  # SheetDB API Endpoint for Timecard Data
8
  SHEETDB_API_URL_TIMECARD = "https://sheetdb.io/api/v1/jsh4nri7t8rko" # Replace with your SheetDB API URL for timecard
 
36
  # Save timecard data to SheetDB
37
  def save_data(employee_name, project_name, project_code, hours, notes):
38
  # Automatically set the date to the current date
39
+
40
+
41
+ # Get current time in UTC
42
+ utc_now = datetime.utcnow()
43
+
44
+ # Convert to IST
45
+ ist = pytz.timezone('Asia/Kolkata')
46
+ ist_now = utc_now.astimezone(ist)
47
+
48
+ # Format in ISO format
49
+ formatted_date = ist_now.isoformat()
50
+
51
 
52
  new_entry = {
53
  "Employee Name": employee_name,