Java tutorial
//package com.java2s; import android.database.sqlite.SQLiteStatement; import android.support.annotation.Nullable; import java.util.Date; public class Main { /** * Binds the date or null to the statement on the given index. * * @param statement The statement. * @param index The index where the value will be bound. * @param value The value to bind. */ public static void bindDateOrNull(SQLiteStatement statement, int index, @Nullable Date value) { if (value != null) { statement.bindLong(index, value.getTime()); } else { statement.bindNull(index); } } }