Last active
May 25, 2024 10:18
-
-
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/70c72e3f3f8fbaed8e67e1eae967e11bb33be147
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 NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// 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