/ Published in: Python
                    
                                        
Always gives me perfect date.
Sample Output
Current Day is: 1
Current Month is: 2
Current Year is: 2020
Current Hour is: 17
Current Minute is: 3
Current Second is: 8
Current Microsecond is: 556483
                Sample Output
Current Day is: 1
Current Month is: 2
Current Year is: 2020
Current Hour is: 17
Current Minute is: 3
Current Second is: 8
Current Microsecond is: 556483
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
from datetime import datetime
now = datetime.now()
print("Current Day is:", now.day)
print("Current Month is:", now.month)
print("Current Year is:", now.year)
print("Current Hour is:", now.hour)
print("Current Minute is:", now.minute)
print("Current Second is:", now.second)
print("Current Microsecond is:", now.microsecond)
URL: https://speedysense.com/get-current-date-time-python/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                