Print("Current timestamp:", time_stamp) Output: Current timestamp: 1647838478 Time_stamp = calendar.timegm(current_GMT) Syntax: calendar.timegm(tuple) Example: import calendar Let us understand this through the following example. In this module, the function calendar.timegm() returns the current time in the timestamp format. In Python, the calendar module provides various functions related to calendar. There are three modules in Python, using which, we can get the timestamp. The timestamp format in Python returns the time elapsed from the epoch time which is set to 00:00:00 UTC for 1 January 1970. In Python we can get the timestamp of an event to an accuracy of milliseconds. time.strftime could be remembered as "string formatted from time" and time.strptime could be remembered as "time represented from string".Timestamp is the date and time of occurrence of an event.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |