Last active
February 3, 2026 20:21
-
-
Save dacr/4298fce08e12ba76ab91e9766be52acb to your computer and use it in GitHub Desktop.
Simple script to generate an ISO8601 date. / published by https://github.com/dacr/code-examples-manager #e4621005-63a0-4c66-91e4-dc8eb894e277/dfcc3c3ca1b9d60733e650a61f89d2d558661534
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : Simple script to generate an ISO8601 date. | |
| // keywords : scala, iso8601, date, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : e4621005-63a0-4c66-91e4-dc8eb894e277 | |
| // created-on : 2020-10-30T18:44:42Z | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.4.2" | |
| // --------------------- | |
| import java.time._ | |
| println(Instant.now().toString) | |
| //println(format.DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(OffsetDateTime.now())) | |
| //println(format.DateTimeFormatter.ISO_ZONED_DATE_TIME.format(ZonedDateTime.now())) | |
| //println(format.DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(Instant.now().atZone(ZoneId.of("UTC")))) | |
| //println(format.DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(Instant.now().atOffset(ZoneOffset.UTC))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment