Last active
May 27, 2023 06:28
-
-
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/dc1fd07c41dd769b18e12dbfcc14648666fc0c45
This file contains 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.3.0" | |
// --------------------- | |
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