UNIX timestamp: the number of seconds that have elapsed since midnight on January 1, January 1, 1970 (UTC/GMT), regardless of the leap second.
Take 25/JUL/2012: 13: 26: 58 as an example.
Python program:
Import time
Import datetime
X = datetime. datetime. strptime ('25/JUL/2012: 13: 26: 58 ',' % d/% B/% Y: % H: % m: % s ')
Time. mktime (X. timetuple ())
Output:
1343194018.0
Note:
Description of formatting the time string in the strptime function:
% A abbreviated weekday name
% A full weekday name
% B abbreviated month name
% B full month name
% C Date and Time Representation appropriate for locale
% D day of month as decimal number (01-31)
% H hour in 24-hour format (00-23)
% I hour in 12-hour format (01-12)
% J day of year as decimal number (001-366)
% M month as decimal number (01-12)
% M minute as decimal number (00-59)
% P current locale's a. m./P. M. Indicator for 12-hour clock
% S second as decimal number (00-59)
% U week of year as decimal number, with Sunday as first day of week (00-51)
% W weekday as decimal number (0-6; Sunday is 0)
% W week of year as decimal number, with Monday as first day of week (00-51)
% X date representation for current locale
% X time representation for current locale
% Y year without Century, as decimal number (00-99)
% Y year with Century, as decimal number
% Z, % Z time-zone name or abbreviation; no characters if time zone is unknown
% Percent sign