Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get current timestamp in Python #45

Closed
tango4567 opened this issue Aug 29, 2022 · 1 comment
Closed

How to get current timestamp in Python #45

tango4567 opened this issue Aug 29, 2022 · 1 comment
Labels

Comments

@tango4567
Copy link
Owner

No description provided.

@tango4567
Copy link
Owner Author

from datetime import datetime
import time
import calendar

    date_time = datetime.fromtimestamp(1887639468)
    Todays_time = time.time()
    date_From_CurrentTime = datetime.fromtimestamp(Todays_time)
    current_GMT = time.gmtime()
    print(Todays_time)
    print('============TimeStamp==============')
    print(calendar.timegm(current_GMT))
    print('============TimeStamp==============')
    dt = datetime.now()
    print(datetime.timestamp(dt))
    print('=============================')
    print("Datetime from timestamp:", date_time)
    print("timestamp:", date_From_CurrentTime)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant