Reputation: 51
I want to print out the date and time in this format like so
4/25/2017 12:45 PM
Upvotes: 2
Views: 4540
Reputation: 122383
os.date has an optional first argument, format, which is used for formatting date and time. e.g.
os.date
format
print(os.date("%m/%d/%Y %I:%M %p")) -- 04/25/2017 04:39 PM
The detail of the format specifiers is in C's strftime.
strftime
Upvotes: 4