# ColumnTypeConverter

Artifact: [androidx.room3:room3-common](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/ColumnTypeConverter.kt+class:androidx.room3.ColumnTypeConverter) Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

*** ** * ** ***


```
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
@Retention(value = AnnotationRetention.BINARY)
public annotation ColumnTypeConverter
```

<br />

*** ** * ** ***

Marks a function as a column type converter.

Converter functions help Room support types beyond the built-in primitives (`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`) and enums. `@ColumnTypeConverter` functions convert column values when reading from a query result or binding parameters into a statement.

Each converter function must receive one parameter and have a non-`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` return type. A class can have as many `@ColumnTypeConverter` functions as needed.

```
object Converters {
    @ColumnTypeConverter
    fun fromTimestamp(value: Long?): Date? {
        return value?.let { Date(it) }
    }

    @ColumnTypeConverter
    fun dateToTimestamp(date: Date?): Long? {
        return date?.getTime()
    }
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/room3/ColumnTypeConverters` |   |