fagfunksjoner.dapla.standards package

Submodules

fagfunksjoner.dapla.standards.time module

Functions that helps Statistics Norway following their specified standards.

Docs: https://statistics-norway.atlassian.net/wiki/spaces/MPD/pages/2953084957/Standardformater

bimester(date=None)

Get bimester period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Bimester period in string format YYYY-Bb.

Return type:

str

date(date=None)

Get date with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Date in string format YYYY-MM-DD.

Return type:

str

date_time(date=None)

Get date and time with standard format.

See: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes

Parameters:

date (datetime | None) – A specified datetime you want to convert to string format. If not specified, it will give the datetime right now.

Returns:

Datetime in string format, YYYY-MM-DDThh:mm:ss, and according to the standards.

Return type:

str

halfyear(date=None)

Get halfyear period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Halfyear period in string format YYYY-Hh.

Return type:

str

month(date=None)

Get month period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Month period in string format YYYY-MM.

Return type:

str

quarterly(date=None)

Get quarter period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Quarter period in string format YYYY-Qq.

Return type:

str

timestamp()

Gives date and time right now with standard format.

Returns:

The standard timestamp.

Return type:

str

triannual(date=None)

Gives triannual period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Triannual period in string format YYYY-Tt.

Return type:

str

week(date=None)

Get week period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Month period in string format YYYYWww.

Return type:

str

year(date=None)

Get year period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Month period in string format YYYY.

Return type:

str

year_days(date=None)

Gives day of year period with standard format.

Parameters:

date (date | None) – A specified date you want to convert to string format. If not specified, it will give the date today.

Returns:

Day of year period in string format YYYY-DDD.

Return type:

str

Module contents

Helper functions to adhere to the standards set at SSB.