module loghelper.convert_helper

Short summary

module pyquickhelper.loghelper.convert_helper

Various functions about conversions.

source on GitHub

Functions

function

truncated documentation

datetime2str

Converts a datetime into a string.

str2datetime

convert a string into a datetime object, it can be:

timestamp_to_datetime

convert a timestamp into a datetime

Documentation

Various functions about conversions.

source on GitHub

pyquickhelper.loghelper.convert_helper.datetime2str(dt)[source]

Converts a datetime into a string.

Parameters:

dt – datetime

Returns:

string

source on GitHub

pyquickhelper.loghelper.convert_helper.str2datetime(dt, format=None)[source]
convert a string into a datetime object, it can be:
  • 2013-05-24 18:49:46

  • 2013-05-24 18:49:46.568

Parameters:
  • dt – string

  • format – format for the conversion, the most complete one is %Y-%m-%d %H:%M:%S.%f which you get by default

Return type:

datetime

Returns:

datetime

source on GitHub

pyquickhelper.loghelper.convert_helper.timestamp_to_datetime(timestamp)[source]

convert a timestamp into a datetime

Parameters:

timestamp – timestamp

Return type:

datetime

source on GitHub