Overview:
-
The function now() returns current local time and date. Without specifying any timezone instance – the datetime returned is not timezone aware.
-
If a concrete timezone instance is passed to the tz parameter then the value is offset with the current local time and date and the returned value is the time in specified timezone.
-
The now() function returns a datetime object.
-
The fold attribute of the returned datetime object can not be modified regardless of the timedelta of the timezone object passed to the now() function. For any such modification a new datetime instance has to be created.
-
The DateTime objects are not DST aware. DST manipulations can be done through derived classes or through other means. However when such DST code is maintained the fold attribute of the datetime object can be set accordingly.
Example:
# Example Python program that gets the current time # Get the current time - without any timezone # Get the current time in New York City # UTC during no DST |
Output:
Current local time: |