This article explores different ways to find the date without time in Kotlin.

1. Using java.util.LocalDate class

The standard class for representing a date without a time is the LocalDate from the java.time package. To get the current date using the system clock and default time-zone, you can use the static function now().

Download Code

Output (will vary):

2017-01-01

 
To get the current date in the desired time zone, you can pass the Zone information to the LocalDate.now() function.

Download Code

Output (will vary):

2017-01-01

2. Using java.util.Date class

To parse a date without time information in the specified format, you can use the DateFormat class. It can be used as follows with the Date object:

Download Code

Output (will vary):

01-01-2017

That’s all about finding the date without time in Kotlin.