Questions tagged [android-date]

276 questions
0
votes
2 answers

Calendar gives -12 hours back

Calendar c = Calendar.getInstance(); String myDateString = (String) DateFormat.format("yyyy-MM-dd hh:mm", c.getTime()); dateTv.setText(myDateString); The output is: 2014-02-13 04:31 The hour is actually not 04, it is 16, i mean it is after noun,…
Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222
0
votes
1 answer

How to Take the correct time zone and location and date time from user

I am using this code to detect the location of the user: // Acquire a reference to the system Location Manager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); // Define a listener that…
Learning Android
  • 273
  • 4
  • 17
0
votes
1 answer

Android DateFormatting

//The First Code /*private String getDisplayTime(String datetime) { try { Date dt = sdf.parse(datetime); if (now.getYear()==dt.getYear() && now.getMonth()==dt.getMonth() && now.getDate()==dt.getDate()) { return…
0
votes
2 answers

How to omit 0 in a whole number Date string

I have successfully changed the format of a date string from yyyy-MM-dd to MM/dd. Now the problem is that if the month and day values are less than 10 each, the format should be for example 2/7 and not 02/07. How do I do this? Here's my code: …
Compaq LE2202x
  • 2,030
  • 9
  • 45
  • 62
0
votes
1 answer

Android SimpleDateFormat Date changes on new day

I have 10 new entry in my listview added dynamically from an edittext with a todays date 12-13-2013 i cant figure out why tomorrow all the dates will read 12-14-2013 i want each entry to keep the date it was entered on and not change any…
0
votes
2 answers

how to sort date which stored in database with string

I am trying to sort SELECT * FROM myTable ORDER BY DATE(date) // date is stored with string Here is the LogCat 11-22 12:50:50.906: I/DB(31388): get :17 Nov 2013 09:36:01 11-22 12:50:50.906: I/DB(31388): get :13 Nov 2013 07:41:29 11-22…
AndyBoy
  • 564
  • 6
  • 29
0
votes
3 answers

DatePickerDialog always opens the current date

I am having trouble with a DatePickerDialog, everytime I open it shows the current date not the date I set previously. Here's my code: final Calendar c = Calendar.getInstance(); final int mYear = c.get(Calendar.YEAR); final int mMonth =…
0
votes
3 answers

Change the dateformat in Android

I am using calender in my app and i want to change the format of the date. private void updateLabel() { String myFormat = "dd/MM/yy"; // In which you need put here SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US); …
Pooja Dubey
  • 683
  • 2
  • 14
  • 34
0
votes
1 answer

How to create a calendar object with a time-zone

I need to create a calendar object instance(with the current time) with the same timezone as…
Akshat Agarwal
  • 2,837
  • 5
  • 29
  • 49
0
votes
1 answer

how to convert calendar object to a specific time zone

I am getting date from database from time-zone A (dBDate) and I am getting the current date from my android device I am currently using in time-zone B (deviceNowDate), I need to find the difference between the 2 dates in milli seconds so I think I…
Akshat Agarwal
  • 2,837
  • 5
  • 29
  • 49
0
votes
3 answers

How to search in sqlite by date?

I'm saving im my table a colum current_date in this format: 'yyyy-MM-dd HH:mm' How to search in database by date? I want, for examble the records from 2013-09-25 discarting the hour. If I do this "Select current_date from mydatabase where…
Roland
  • 826
  • 2
  • 9
  • 24
0
votes
1 answer

Joda-Time and Android system time

Currently Joda DateTime can get the current Android system time, but is it possible to get the DateTime when say the Android system date or timezone has changed? I have tried this after the Date/Timezone has changed but it does not work: DateTime dt…
Ash
  • 1,241
  • 1
  • 9
  • 16
0
votes
2 answers

How to convert a String to a Calendar object?

To store a Calendar object in SQLite database, i found that the easiest way is to convert the Calendar object to a string and store it in the database as text. Now, the problem lies in extracting the stored date from the string. How do I parse the…
Randomly Named User
  • 1,889
  • 7
  • 27
  • 47
0
votes
2 answers

Inserting data to record in sqlite

I have to make an Android application in which i have to store predefined question and answer, using sqlite to store data. I found tutorials in which values are inserted every time we run the application, but i have to insert these questions and…
user2326414
  • 27
  • 1
  • 6
0
votes
1 answer

store in date format without showing all the details (GMT , time)

Is it possible to store the current date in a file but no as a string? What I mean: If I use : SimpleDateFormat thedate = new SimpleDateFormat("dd/MM/yyyy"); Date d=new Date(); String formattedDate=thedate.format(d); date.add(formattedDate); It…
George
  • 5,808
  • 15
  • 83
  • 160