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

  • Home
  • SEARCH
  • 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 7800851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:46:10+00:00 2026-06-02T00:46:10+00:00

At the db side, checkInTime and checkOutTime are of type TIMESTAMP In my java

  • 0

At the db side, checkInTime and checkOutTime are of type TIMESTAMP

In my java code also, checkInTime and checkOutTime are of type java.sql.Timestamp

For inserting a record into db, i am using this piece of code:

1. ContentValues contentValues=new ContentValues();

    2. contentValues.put(USER_ID, userId);
    3. contentValues.put(ROOM_ID, roomId);
    4. contentValues.put(CHECK_IN, checkInTime);
    5. contentValues.put(CHECK_OUT, checkOutTime);

    6. return database.insert(MRM_BOOKING_DETAILS_TABLE, null, contentValues);

But i am getting compilation errors at line 4 and 5 since they are not expecting something of type java.sql.Timestamp

I can’t see any put method of ContentValues which will accept type java.sql.Timestamp in its second parameter. Please suggest how to pass the java.sql.Timestamp in such a case so that i can remove the compilation errors as well.

Thanks,

  • 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-02T00:46:12+00:00Added an answer on June 2, 2026 at 12:46 am

    I would suggest you to use DATETIME instead of TIMESTAMP. Its more general when handling dates and times.

    Moreover, you can use SimpleDateFormat to parse DATETIME values when inserting or reading from database.

    final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    

    Updated:

    Try doing it as below:

    final SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-ddTHH:mm:ss.SSS");
    
    contentValues.put(CHECK_IN, parser.format(checkInTime));
    contentValues.put(CHECK_OUT, parser.format(checkOutTime));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my client-side jQuery code: $.ajaxSetup ({ contentType: application/json, datatype: 'json' }); $.ajax({ type:
This is my Server side code: public void ReceivingData(object sender, EventArgs e) { while
Side note: This is inherited code, I didn't do any of the setup and
I have a server-side webpy code like this: urls = ( '/home', 'homePage', '/clients/(.*)',
For GWT client side you need Java source code so i got that idea
My service side code is implemented using Resteasy @GET @Path(/ad-details/{query}) @Produces(application/json) public String getAdDetails(@PathParam(query)
Is there a side effect in doing this: C code: struct foo { int
I'm outputting client side function calls from code behind via Page.ClientScript.RegisterStartupScript( this.GetType(), supportItems, scriptCalls,
This side says that it can support https through the code provided. However, the
Server side I have this Java: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException

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.