Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:01:12+00:00 2026-06-17T13:01:12+00:00

I’m trying to insert the values from a date picker and a time pickers

  • 0

I’m trying to insert the values from a date picker and a time pickers in my sqlite database. I have stored the date and time in object variables and then call a method in my DBhandler class to insert them through a contentvalue object.

Now where I’m failing here is with the actual insertion and data types.

I’m getting an error on the following code for the ‘timeApp’ and ‘dateApp’ I’m passing these variables to the createAppointmentEntry’ method as DATE and TIME variables.:

Error message:

 The method put(String, String) in the type ContentValues is not applicable for the arguments (String, Time)

Method the errors occuring on:

public void createAppointmentEntry(String nameApp, String typeApp, Time timeApp, Date dateApp ,String commentApp, Boolean onOrOff) {



        ContentValues cv = new ContentValues();
        cv.put(KEY_NAMEAPP, nameApp);
        cv.put(KEY_TYPEAPP, typeApp);

                    //ERROR on the following two 'puts'
        cv.put(KEY_TIMEAPP, timeApp);
        cv.put(KEY_DATEAPP, dateApp);

        cv.put(KEY_COMMENTAPP, commentApp);
        cv.put(KEY_ALARM, onOrOff);
        ourDatabase.insert(DATABASE_TABLE, null, cv);

Heres my DB columns:

    public static final String KEY_ROWAPPID = "_appid";
public static final String KEY_NAMEAPP = "app_name";
public static final String KEY_TYPEAPP = "app_type";
public static final String KEY_TIMEAPP = "app_time";
public static final String KEY_DATEAPP = "app_date";
public static final String KEY_COMMENTAPP = "app_comments";
public static final String KEY_ALARM = "app_alarm";

My onCreate method:

db.execSQL("CREATE TABLE " + DATABASE_TABLEAPP + " (" +
            KEY_ROWAPPID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                KEY_NAMEAPP + " TEXT NOT NULL, " +
                KEY_TYPEAPP + " TEXT NOT NULL, " +
                KEY_TIMEAPP + " TEXT NOT NULL, " +
                KEY_DATEAPP + " TEXT NOT NULL, " +
                KEY_COMMENTAPP + " TEXT NOT NULL, " +
                KEY_ALARM + "BOOLEAN NOT NULL);"

                );

Heres how I am setting the time and date object variables:

    Date setDate = new Date(dobYear - 1900, dobMonth, dobDate);


Time timeToSet = new Time();
timeToSet.set(0, dobMinute, dobHour);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:01:13+00:00Added an answer on June 17, 2026 at 1:01 pm

    Judging from the compilation error and the API of ContentValues, it seems that ContentValues only supports primitive types, String and byte[]. So, try replacing:

    //ERROR on the following two 'puts'
     cv.put(KEY_TIMEAPP, timeApp);
     cv.put(KEY_DATEAPP, dateApp);
    

    with:

     cv.put(KEY_TIMEAPP, timeApp.toString());
     cv.put(KEY_DATEAPP, dateApp.toString());
    

    You can use formatter to format the Time and Date to a standard String to be able to parse it back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view passing on information from a database: def serve_article(request, id): served_article
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.