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 9271749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:41:57+00:00 2026-06-18T15:41:57+00:00

In android I am using SqlLite with MyDate row like DATETIME DEFAULT CURRENT_TIMESTAMP .

  • 0

In android I am using SqlLite with MyDate row like DATETIME DEFAULT CURRENT_TIMESTAMP. But when i am reading date i get date one hour back because i am using GMT + 1 in my android environment.

MyDate: 12:03 
Android date: 13:03

When reading from SqlLite how can i convert it to GMT + X, depends on android environment?

EDIT:

code:

     Cursor cursor = logsDao.getAll(LogsDao.KEY_ID + " DESC", "100");
            String[] columns = new String[] { LogsDao.KEY_CONTENT, LogsDao.KEY_COMMENT, LogsDao.KEY_CREATED };
            int[] to = new int[] { R.id.logContext, R.id.logComment, R.id.logCreated };
            SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, 
            R.layout.log_entry, cursor, columns, to);
            setListAdapter(mAdapter);
  • 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-18T15:41:58+00:00Added an answer on June 18, 2026 at 3:41 pm

    I suppose that first you should store your retrieved data in a Timestamp with UCT timezone, then update the current Timezone in according with the one of the mobilephone.

    String s = "2013-02-11 12:03:00";
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    df.setTimeZone(TimeZone.getTimeZone("UCT"));
    Date timestamp = null;
    try {
        timestamp = df.parse(s);
        df.setTimeZone(TimeZone.getDefault());
    } catch (ParseException e) {
        e.printStackTrace();
    }
    

    You need to implement a custom cursorAdapter and in the method bindView manipuulate your date

    @Override
        public void bindView(View v, Context context, Cursor c) {
            String date;
            date= c.getString(c.getColumnIndex(LogsDao.KEY_CREATED));
    
            //implement change of timezone
    
            TextView date_text = (TextView) v.findViewById(R.id.date);
            if (date_text != null) {
                date_text.setText(date);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I get the row count of a query in Android using SQLite?
Sending Email in Android using JavaMail API without using the default/built-in app I'm trying
I am doing push notification for android using C2DM. it works well. but while
I am in process of developing an Android tablet app using sqllite 3.7.4 which
I am trying to create an Android dictionary-like application and get slow performance on
I have using SQLLite in my Android Application for sometimes now, and am getting
I've started using SQLite for my Android applications. What I would like to know
In Android 4.2, using SQLite 3.7.11, when I delete a row from the Quizzes
I'm developing an android app using sqllite db and I wanted to know if
i was published android apps using sqlite in local db.now i am add one

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.