Convert Snort string to Python timestamp -


i'm using snort, generates timestamps in mm-dd/time format, such as:

06/18-19:31:05.688344 

i want convert python timestamp, including current year. what's pythonic way?

use datetime module's strptime function.

>>> import datetime >>> datetime.datetime.strptime(str(datetime.datetime.now().year) + ... '/' + '06/18-19:31:05.688344', '%y/%m/%d-%h:%m:%s.%f') datetime.datetime(2015, 6, 18, 19, 31, 5, 688344) 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -