Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/scala/com/simple/jdub/Row.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.joda.time.{DateTime, DateTimeZone}
import java.io.{InputStream, Reader}
import java.net.URL
import java.sql.{Blob, Clob, Date, NClob, Ref, ResultSet, SQLXML, Time, Timestamp}
import java.time.{Instant, LocalDateTime}
import java.time.{Instant, LocalDateTime, LocalDate}
import java.util.UUID

/**
Expand Down Expand Up @@ -175,6 +175,11 @@ class Row(rs: ResultSet) {
*/
def localDateTime(name: String): Option[LocalDateTime] = timestamp(name).map(_.toLocalDateTime)

/**
* Extract the value with the given name as an Option[LocalDate].
*/
def localDate(name: String): Option[LocalDate] = extract(rs.getDate(name).toLocalDate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could do:

localDateTime(name).map(_.toLocalDate)


/**
* Extract the value with the given name as an Option[DateTime].
*/
Expand Down