Code example for SimpleDateFormat

Methods: format

0
     * @return the row id associated with the created entry or -1 of an error 
     * occurred 
     */ 
    public long create(long reference, int version) {
        // Create a sql date time format 
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
 
        ContentValues initialValues = new ContentValues();
        initialValues.put(KEY_REFERENCE, String.valueOf(reference));
        initialValues.put(KEY_VERSION, version);
        initialValues.put(KEY_NOTIFIED_AT, dateFormat.format(date));
 
        return mDb.replace(DATABASE_TABLE, null, initialValues);
    } 
 
    /** 
     * Fetch a entry by it's reference. 
     * @param type the type 
     * @param name the name 
     * @return a Cursor object positioned at the first entry