Skip to content

Time #5

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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