Skip to content

lbasek/kotlinx-datetime-playground

Repository files navigation

kotlinx-datetime Playground

This repository serves as a playground with kotlinx-datetime library. Some basic functionalities of the library are presented through a few tasks/examples.

Tasks:

  1. Get the current time and print the following:
    • Current time in ISO8601 format
    • Current time in UNIX timestamp format

  1. Get the current time and print the following:
    • System Time Zone
    • Current time adjusted to the time zone: Europe/Zagreb
    • Current time adjusted to the time zone: America/New_York

  1. Get the current time and print the following:
    • All Local Date Time object attrs

  1. Parse the given UNIX timestamp and print following:
    • Time in ISO8601 format in GMT/UTC+0
    • Time in ISO8601 format in UTC+2 or System Time Zone
  • Get current UNIX timestamp and print in milliseconds

  1. Try parse following formats with Instant class:
    • "2010-06-01T22:19:44.475Z"
    • "1994-11-05T08:15:30-05:00"
    • "1994-11-05T08:15:30"
  • Try parse following formats with LocalDateTime class
    • "2010-06-01T22:19:44.475"
    • "2010-06-01T22:19:44.475Z"

  1. Explore how arithmetic operations works with the Instant class. Calculate time period between:
    • "2020-01-01T00:00:00Z"
    • Current time + 1 year + 6 months

  1. Try format the date to date you use daily e.g. 9.6.2022 20:34

Resources

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages