3

I am trying to get the date and time on python for a program I am writing, But I am unsure how to get them. I tried to do it like the following:

import datetime import date 

This usually works but now it just prints:

<module 'time' (built-in)> <module 'datetime' from 'C:\\Python34\\lib\\datetime.py'> 

How can I fix this?

4
  • Please check stackoverflow.com/questions/311627/… Commented Dec 15, 2015 at 18:36
  • 1
    Thx, must have missed that when I searched @mrDinkelman Commented Dec 15, 2015 at 18:37
  • 1
    @bgporter I have edited it to make it unique, can you please take it off duplicate? Commented Dec 15, 2015 at 18:46
  • 2
    No, ask a new question Commented Dec 15, 2015 at 18:54

1 Answer 1

1

Formatted time: datetime.datetime.now().strftime('%d/%m/%Y %H:%M')

Datetime object: datetime.datetime.now()

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.