All Questions
29
questions
0
votes
2
answers
55
views
How Can I Make My Calendar Ignore DST Adjustments?
I’m trying to calculate the time by adding minutes to given date-time. It’s works well with other times but not for the DST times [ Canada Eastern time ].
public static GregorianCalendar addMinuts(...
0
votes
2
answers
828
views
How to convert a timestamp to years, month, days and hours in Android?
I want to convert a timestamp like 62207486144 to days(like 1 year 6 months 2 days 3 hours 33 minutes) in my Android App. How can I do that? I am able to get days and hours but not years or months ...
0
votes
1
answer
492
views
How to add days and get timestamp in Android?
I want to add days like 30, 60, 90, etc to a date a timestamp like 1642599000000 and want to get the new timestamp. I am using the following code but not working properly. It only works for 30 days ...
0
votes
2
answers
349
views
Calendar: how to get string “10:00 AM”
I’m trying to get a string like e.g. “10:00 AM”
int numberOfHourFrom_0_to_23=10;
Calendar m_auxCalendar = new GregorianCalendar();
m_auxCalendar.set(Calendar.HOUR, numberOfHourFrom_0_to_23 +12);//+12 ...
0
votes
0
answers
112
views
Use the Gregorian, Jalali and Hijiri calendars in the application
I need a Date picker to be able to set it's time types(Gregorian,Jalali or Hijiri)from setting and change it to each others too... and all the items that work by DATE will get new value...as I didn't ...
0
votes
0
answers
109
views
Why does the Calendar (GregorianCalendar)'s time change by 12 hours when setting the Hours and Minutes, after midnight, as opposed to before midnight [duplicate]
I'm Creating a Calendar of type GregorianCalendar and setting it to my timezone (GMT+12)
Then I literally set the time from strings for hour and minute eg "06" "37"
Then display the time in ms
If I do ...
0
votes
1
answer
86
views
calendar setFirstDayOfWeek for entire app
I have a time registration app and some users requested to change to first day of the week according to their preferences. I know I can set the first day of the week on a calendar object, but I'm ...
1
vote
1
answer
4k
views
How to Format Hijri Date
I'm using time4A to do transformation from Islamic Hjiri to Gregorian Date and vice versa. I'm not able to find a way to format Hijri Date to "yyyy/mmm/dd" pattern.
Here is the code to convert from ...
4
votes
2
answers
5k
views
Android Use Non-Gregorian Calendars
I'm creating a DatePickerDialogFragment where the user will select date of birth. I am wanting to make sure I can handle dates which are non-gregorian. I have not been able to change which type of ...
3
votes
2
answers
2k
views
Get current julian day number with gregorian calendar in android
android.text.format.Time has a method called getJulianDay that returns the day number since epoch. But docs says that:
This class was deprecated in API level 22. Use GregorianCalendar
instead.
...
1
vote
2
answers
72
views
How to set a day of month for day of the week?
in my app i can set an alarm for any the days of the week, i want to display a toast with the time until the next alarm, i set a value for every day:
String[] str = new String[7];
str[0] = ...
3
votes
1
answer
319
views
Get day (of week) of a special Date Java? [duplicate]
I have a Gregorian Date and I want to get it's day of week. I have try this but get wrong answer:
Calendar calendar = new GregorianCalendar();
calendar.set(myYear, myMonth, myDay);
int result = ...
1
vote
2
answers
51
views
Clearing Calendar.HOUR adds hundreds of days
I'm using the lines of code:
1 GregorianCalendar cal = (GregorianCalendar) date.clone();
2 cal.clear(Calendar.HOUR);
When using this code in a unit test - it runs just fine. However when running ...
1
vote
2
answers
77
views
Using GregorianCalendar to get weeks
I'm looking to utilize GregorianCalendar to do some logic based on days. Is there any way to see if 2 dates are in the same week? I've tried using get(Calendar.WEEK_OF_YEAR), and this has the two ...
2
votes
2
answers
2k
views
SimpleDateFormat hour string off-by-one on certain *dates*. How? Why?
I'm using SimpleDateFormat to turn my GregorianCalendar instances into nice strings. I'm having a weird issue where in certain dates the time string is off by one, but not always.
Normally, if my ...