![]() |
Unable to pass date timestamp as Parameters : - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Unable to pass date timestamp as Parameters : (/thread-27793.html) |
Unable to pass date timestamp as Parameters : - nagu4651 - Jun-22-2020 Hi Team , Need small help .. I just want to pass time stamps for end and start . How can I do this in below code could you please help me with this For example Start as todays morning 09:15 AM and end as current time stamp tech_list = ['AAPL','GOOG','MSFT','AMZN'] end = datetime.now() start = datetime(end.year - 1,end.month,end.day) for stock in tech_list: # Set DataFrame as the Stock Ticker globals()[stock] = DataReader(stock,'yahoo',start,end) RE: Unable to pass date timestamp as Parameters : - Larz60+ - Jun-22-2020 you can use time to get start and end time (run once before starting process, once after then subtract difference) Or a better approach would be to use time.process_time example from time import process_time def fibo(n): if n <= 1: return n else: return(fibo(n-1) + fibo(n-2)) start_time = process_time() print(f"\nStarting process at: {start_time}") # pass some time for x in range (30): print(f"{fibo(x)} ", end ='') stop_time = process_time() print(f"\nTotal time: {stop_time - start_time} seconds.\n")output of above:
|