Package: datetime-toolkit
Datetime ToolkitPython package to work with NTP servers, time zones, and localized names of months and days of the week.Report Bug·Request FeatureTable of Contents🏁 Getting StartedPrerequisitesInstallation✨ UsageDefault instantationCustom instantationClass DatetimeToolkit properties and methods🤝🏼 Contributing📜️️ License📬 Contact🙏🏼 Acknowledgments🏁 Getting StartedPrerequisitesPython 3InstallationUsingpippipinstalldatetime_toolkit(back to top)✨ UsageDefault instantationDefault parameters are from 🇨🇱 Chile:NTP Server:ntp.shoa.clTime zone: America / SantiagoLocale:Your system default localeTo use custom locale, the language must be installed on your system. On Linux, check your/etc/locale.genfile.
For example, I have English, Spanish and German installed.grep-v"#"/etc/locale.gen

en_US.UTF-8UTF-8
es_CL.UTF-8UTF-8
de_DE.UTF-8UTF-8datetime_toolkit=DatetimeToolkit(locale='es_CL.UTF-8')print(datetime_toolkit.months)print(datetime_toolkit.days)# Printed values['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre']['Lunes','Martes','Miércoles','Jueves','Viernes','Sábado','Domingo']Custom instantationTo use custom parameters, use the countryISO 3166 alpha-2 codeto find your country information.For example, the country code for 🇩🇪 Germany is "DE", so you can use:info=DatetimeToolkit.country_information(alpha_2_code='de')# Static method country_information(code) will return a dictionary like thisinfo={'country':'Germany','time_zones':['Europe/Berlin','Europe/Busingen']}I will usePTB NTP server(ptbtime1.ptb.de) and the timezone from Berlin.datetime_toolkit=DatetimeToolkit(ntp='ptbtime1.ptb.de',tz='Europe/Berlin',locale='de_DE.UTF-8')print(datetime_toolkit.months)print(datetime_toolkit.days)# Printed values['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag']Class DatetimeToolkit properties and methodsPropertyReturnsdaysList with the names of the days of the week as strings. Language used is determined by locale parameter or system default. First letter is uppercase and the rest lowercase.monthsList with the names of the months as strings. Language used is determined by locale parameter or system default. First letter is uppercase and the rest lowercase.MethodReturns@staticmethodcountry_information(alpha_2_code: str)Dictionary with country information. Keys are the strings "country" and "time_zones".locale()Locale used as string. None if no locale was provided.server_url()NTP server URL/IP as string.tz()Object datetime.tzinfo for the given time zone.local_time()Float timestamp of the current local time. Wrapper of time.time()server_time()Integer timestamp of the server time.datetime(is_request_forced = False, is_utc = False)Datetime object using given time zone.string(is_request_forced = False, is_utc = False, string_format = '%Y-%m-%d %H:%M:%S')String representing datetime using string_format.float_to_datetime(timestamp: float, is_utc = False)Datetime from timestamp using given time zone.float_to_string(timestamp: float, is_utc = False, string_format = '%Y-%m-%d %H:%M:%S')String from timestamp using given time zone and string_format.name_month(custom_datetime: datetime = None, is_request_forced = False, is_utc = False)String of the localized month name. If custom_datetime is None, it will use datetime() method.name_day(custom_datetime: datetime = None, is_request_forced = False, is_utc = False)String of the localized day name. If custom_datetime is None, it will use datetime() method.(back to top)🤝🏼 ContributingContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make aregreatly appreciated.If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!Fork the ProjectCreate your Feature Branch (git checkout -b feature/AmazingFeature)Commit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull Request(back to top)📜️️ LicenseDistributed under theMIT License. SeeLICENSE.txtfor more information.(back to top)📬 Contact👨🏻‍💻 Sebastián Valdivia Loyola [✉️ E-Mail-📂 GitHub-📦 Project](back to top)🙏🏼 AcknowledgmentsBest-README-Template(back to top)