Python‎ > ‎time‎ > ‎

time.strftime


Introduction
Return after converting a time tuple to a string according to a format specification.

Syntax
strftime(format[, tuple]) -> string

Parameters
N/A

Import module
Importing module is required in the Shell window and the Editor window.

Examples
Getting year info.
 >>>import time
>>> time.strftime("%y")
'15'
>>>

Getting full time info in localtime. 
import time
x=()
y=time.strftime("'%Y','%m','%d','%H','%m','%S'",time.localtime())
print(y)

Output
>>> 
'2015','01','30','23','01','04'
>>>



Comments