Advertisement
NubeColectiva

Como Obtener la Fecha y Hora con Kotlin

Jun 15th, 2023
1,537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.34 KB | Source Code | 0 0
  1. import java.time.LocalDateTime
  2. import java.time.format.DateTimeFormatter
  3. import java.util.Locale
  4.  
  5. fun main(args: Array<String>) {
  6.  
  7.     val formato = DateTimeFormatter.ofPattern("dd-MM-yyyy hh:mm:ss a",
  8.     Locale.ENGLISH)
  9.     val fechayhora = LocalDateTime.now().format(formato)
  10.  
  11.     println("La fecha y hora actual es: $fechayhora")
  12.  
  13. }
Tags: Kotlin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement