gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: LocalDateTime->ZonedDateTime


From: gnunet
Subject: [libeufin] branch master updated: LocalDateTime->ZonedDateTime
Date: Mon, 25 May 2020 17:04:44 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 3db2403  LocalDateTime->ZonedDateTime
3db2403 is described below

commit 3db2403f55914a2251afbd48abae95c161a16ee5
Author: MS <address@hidden>
AuthorDate: Mon May 25 17:04:40 2020 +0200

    LocalDateTime->ZonedDateTime
---
 util/src/test/kotlin/TimeTest.kt | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/util/src/test/kotlin/TimeTest.kt b/util/src/test/kotlin/TimeTest.kt
index a91d73f..1b9183e 100644
--- a/util/src/test/kotlin/TimeTest.kt
+++ b/util/src/test/kotlin/TimeTest.kt
@@ -1,11 +1,8 @@
 import org.junit.Test
-import java.time.Instant
-import java.time.LocalDate
-import java.time.LocalDateTime
-import java.time.ZoneId
+import java.time.*
+import java.time.format.DateTimeFormatter
 
 class TimeTest {
-
     @Test
     fun importMillis() {
         fun fromLong(millis: Long): LocalDateTime {
@@ -17,4 +14,20 @@ class TimeTest {
         val ret = fromLong(0)
         println(ret.toString())
     }
+
+    @Test
+    fun formatDateTime() {
+        fun formatDashed(dateTime: LocalDateTime): String {
+            val dtf = DateTimeFormatter.ISO_LOCAL_DATE
+            return dtf.format(dateTime)
+        }
+        fun formatZonedWithOffset(dateTime: ZonedDateTime): String {
+            val dtf = DateTimeFormatter.ISO_OFFSET_DATE_TIME
+            return dtf.format(dateTime)
+        }
+        val str = formatDashed(LocalDateTime.now())     
+        println(str)
+        val str0 = 
formatZonedWithOffset(LocalDateTime.now().atZone(ZoneId.systemDefault()))
+        println(str0)
+    }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]