Timestamp¶
This documentation provides details about the data that can be faked for a timestamp.
To retrieve generated/fake data for a timestamp see the following capabilities:
from socfaker import SocFaker
sc = SocFaker()
print(sc.timestamp.in_the_past())
print(sc.timestamp.in_the_future())
print(sc.timestamp.current)
print(sc.timestamp.date_string())
Timestamp Class¶
-
class
socfaker.timestamp.Timestamp¶ The Timestamp Class provides methods to generate timestamps
-
current¶ The current timestamp
- Returns:
- str: Returns the current timestamp in ISO 8601 format
-
date_string(years=60, months=9, days=216)¶ Returns a date string
- Args:
- years ([type], optional): The number of years subtracted from the current time. Defaults to random.randint(18,85). months ([type], optional): The number of months subtracted from the current time. Defaults to random.randint(1,12). days ([type], optional): The number of days subtracted from the current time. Defaults to random.randint(1,365).
- Returns:
- str: An date string for the generated timestamp
-
in_the_future(years=0, months=0, days=12, hours=9, minutes=46, seconds=46)¶ Generates a timestamp in the future
- Args:
- years (int, optional): The number of years to add from the current time. Defaults to 0. months ([type], optional): The number of months to add from the current time. Defaults to random.randint(0,3). days ([type], optional): The number of days to add from the current time. Defaults to random.randint(1,15). hours ([type], optional): The number of hours to add from the current time. Defaults to random.randint(1,24). minutes ([type], optional): The number of minutes to add from the current time. Defaults to random.randint(1,60). seconds ([type], optional): The number of seconds to add from the current time. Defaults to random.randint(1,60).
- Returns:
- str: Returns an ISO 8601 timestamp string
-
in_the_past(years=0, months=3, days=13, hours=18, minutes=47, seconds=53)¶ Generates a timestamp in the past
- Args:
- years (int, optional): The number of years to subtract from the current time. Defaults to 0. months ([type], optional): The number of months to subtract from the current time. Defaults to random.randint(0,3). days ([type], optional): The number of days to subtract from the current time. Defaults to random.randint(1,15). hours ([type], optional): The number of hours to subtract from the current time. Defaults to random.randint(1,24). minutes ([type], optional): The number of minutes to subtract from the current time. Defaults to random.randint(1,60). seconds ([type], optional): The number of seconds to subtract from the current time. Defaults to random.randint(1,60).
- Returns:
- str: Returns an ISO 8601 timestamp string
-
in_the_past_pendulum_object(years=0, months=1, days=13, hours=15, minutes=36, seconds=37)¶
-