I have a python web app which extracts few files from the webserver. Files are named as per date, so it looks like
transData2018/09/13.csv
These files are uploaded by someone whose timezone is GMT-4. My timezone is GMT+8. As of now, I am running the python app locally so the app is ahead. Now because it is ahead of date time, the code has to look for the files of previous day. So considering if today's date is 15-Sept, code has to look for files with date 14-Sept. This all setup works fine locally.
Now my plan is to deploy this python app on azure web app platform. Once deployed, I do not know which timezone it will work in and what time it will pick. Based on that, should the code look for the previous date in the files or just the todays date.
In the code I am doing:
previous_date = str(datetime.now().date() - timedelta(days=1))
to get the previous date value but this will probably fail in scenario:
- If they uploaded the file on
15th-Septso the files will have nametransData2018/09/15.csv, but the code will look for the filetransData2018/09/14.csvwhich is not correct.
How should I deal with this situation? Thanks