Skip to content

Time #5

@chris-martin

Description

@chris-martin

There's some extremely common time-related tasks it'd be really nice to demonstrate.

  • Rendering and parsing yyyy-mm-dd format
  • Getting the current unix timestamp as an integer in the units of your choice (e.g. seconds or milliseconds)
  • Converting a unix timestamp to an appropriate time type (e.g. if we're consuming a JSON API that expresses a time as a timestamp)
  • Basic time arithmetic, like getting a time that represents "a year from now"

If using the time package, make sure you're using the latest version, because the API has changed a bit recently. time has gotten a bit better with the new changes but I wouldn't mind recommending a different library if anybody can recommend something friendlier.

Potential idea for a practial example: use the cookies library to generate a set-cookie header for a cookie that is set to expire one month in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good for new contributorsPull requests welcome!new exampleThis issue is about writing a new example program.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions