Python datetime.date.isoformat() Examples

The following are 2 code examples of datetime.date.isoformat(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module datetime.date , or try the search function .
Example #1
Source File: convert.py    From particle with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def version_header(filename, version_number):
    filename = os.path.basename(filename)
    VERSION = version_number  # version of CSV files
    DATE = date.isoformat(date.today())
    return "# (c) Scikit-HEP project - Particle package data file - {fname} - version {version} - {date}\n".format(
        fname=filename, version=VERSION, date=DATE
    ) 
Example #2
Source File: test_global_config.py    From dataclasses-json with MIT License 5 votes vote down vote up
def test_encoder_extension(self):
        dataclasses_json.cfg.global_config.encoders[date] = date.isoformat
        assert PersonWithBirthday("Kobe Bryant", date(1978, 8, 23)).to_json() \
               == '{"name": "Kobe Bryant", "birthday": "1978-08-23"}'
        dataclasses_json.cfg.global_config.encoders = {}