DateTime#

class pyopenms.DateTime#

Bases: object

DateTime Class

__init__() → None#
__init__(arg: pyopenms.DateTime, /) → None

Methods

__init__()

clear()

get()

Returns a string representation of the date and time

getDate()

getDateAndTime()

Returns date and time components as a tuple

getDateComponents()

Returns (month, day, year) as a tuple of integers

getTime()

getTimeComponents()

Returns (hour, minute, second) as a tuple of integers

isNull()

Returns true if the DateTime is null (default constructed)

isValid()

Returns true if the DateTime is valid

now()

set(month, day, year, hour, minute, second)

Sets date and time

setDate(date)

setTime(date)

clear() → None#
get() → str#

Returns a string representation of the date and time

The format of the string will be yyyy-MM-dd hh:mm:ss

getDate() → str#
getDateAndTime() → tuple#

Returns date and time components as a tuple

Returns:

Tuple of (month, day, year, hour, minute, second) as integers

getDateComponents() → tuple#

Returns (month, day, year) as a tuple of integers

getTime() → str#
getTimeComponents() → tuple#

Returns (hour, minute, second) as a tuple of integers

isNull() → bool#

Returns true if the DateTime is null (default constructed)

isValid() → bool#

Returns true if the DateTime is valid

static now() → pyopenms.DateTime#
set(month: int, day: int, year: int, hour: int, minute: int, second: int) → None#
set(date: str) → None

Sets date and time

The following formats are supported:

  • MM/dd/yyyy hh:mm:ss

  • dd.MM.yyyy hh:mm:ss

  • yyyy-MM-dd hh:mm:ss

  • yyyy-MM-ddThh:mm:ss (ISO 8601 format)

  • yyyy-MM-ddZ (ISO 8601 format)

  • yyyy-MM-dd+hh:mm (ISO 8601 format)

setDate(date: str) → None#
setDate(month: int, day: int, year: int) → None
setTime(date: str) → None#
setTime(hour: int, minute: int, second: int) → None