Questions tagged [java-calendar]

An abstract class in Java that is used to convert an instance in time from Epoch to a specific date.

61 questions
0
votes
2 answers

Parsing user input in edittext field of the type date and check for correct date format

I am working on an Android app and processing user input from an edittext field. I want to check if the user entered a correct date format; however, for reasons that I don´t understand, I need to convert the type of the edittext type date to a…
0
votes
1 answer

Set android alarm in UTC

I'm using an API to fetch movie releases for my Android app and the release dates are in milliseconds UTC. When I take that release date and set it on the user's phone it gets converted in his time zone and called. Example: A movie's release date…
user7409907
0
votes
1 answer

Java Calendar: I want to remove specific Day of week from calendar

More details I want to get rid of specific days of the week. I mean like: {Sat(1), Sun(2), Mon(3) , Tues(4) , Wed (5),Thurs(6) ,Fri(7)}. Remove Week Days: {Sat(1), Sun(2), Mon(3) , Tues(4) , Wed (5)}. So I can get the Count of days without the…
Mohamed Gabr
  • 430
  • 5
  • 18
0
votes
2 answers

Java Gregorian calendar outputting wrong date

im working on a Gregorian calendar project where i have to print 100 days from today and day of week of my birthday. The program displays a day, however its the wrong day. could you guys help me with the problem? thanks! import…
Tim
  • 19
  • 3
0
votes
2 answers

Current week monday date

In my case week start from Monday to Sunday.I want get current week Monday date. I using following code to get Monday date. Calendar c = Calendar.getInstance(); c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); …
Joe
  • 550
  • 2
  • 11
  • 21
0
votes
1 answer

Object field getting overwritten when using ArrayList [Debug Help]

There might be something very simple that I'm missing here but basically I have objects that I wish to store in an arrayList that is global. However when I leave the function, and try to access the object elements in this same arrayList, a field is…
J Z
  • 89
  • 1
  • 8
0
votes
4 answers

Get Start day and End day of a Week? [Java]

I am developing an app that constantly monitors the user's physical activity and inactivity levels. I am trying to figure out out to get the starting and ending day of a week when a date is provided. For example, 3 Mar is the date that I am…
Georgi Koemdzhiev
  • 11,421
  • 18
  • 62
  • 126
-1
votes
2 answers

To find the weekly date range based on the input

I am having scenario with my property file input like below for weekly reports Data lag - 10 days Run day - Tuesday. The requirement is based on the date lag: I have to move the calendar 10 days back. Then I want to find the Tuesday (any weekday may…
-1
votes
2 answers

Calendar date validation isn't returning correct boolean

I'm trying to validate a calendar date, but when it is validated, the code returns false regardless of input. String strDateOfBirth = userInputArrayList.get(7) + "/" + userInputArrayList.get(8) + "/" + userInputArrayList.get(9); Log.d(TAG, "1Date of…
S.Wilko
  • 11
  • 6
-1
votes
2 answers

Get current year for variable - Java

I have three variables where I need the current year, one year ago from the present time, and two years ago from the present time, using Java. Would something like this work?: String DNRCurrentYear = new SimpleDateFormat("yyyy").format(new…
BigRedEO
  • 807
  • 4
  • 13
  • 33
-1
votes
3 answers

How to get previous 7 dates from a particular date in java?I am getting 7 dates from present date, but I want from particular date

//explain public class DateLoop { static String finalDate; static String particularDate; public static void main(String[] args) { // TODO Auto-generated method stub SimpleDateFormat sdf = new SimpleDateFormat("d-M-yyyy…
-2
votes
1 answer

Date(System.currentTimeInMillis) not working

I wanted today's date using the date object so I passed System.currentTimeInMillis in Date() constructor but it returns the year as 121 Then I used Calendar class and it solved my problem, but why wasn't Date() class working in the first place?
ADITYA DIXIT
  • 141
  • 1
  • 11
-2
votes
4 answers

Simplest way to convert Java Calendar to ISO

I've got a Calendar that comes back in a following format (it's in Java Calendar type): 2020-02-15T00:00:00. What's the simplest, shortest way to convert it to the following Calendar like this one and persist the Calendar type: Mon Nov 05 2018…
LazioTibijczyk
  • 1,701
  • 21
  • 48
-3
votes
1 answer

program that asks the user to enter the day number of the year, and the program returns the date by specifying the month and day

How i can write a program that asks the user to enter the day number of the year (assuming there are 365 days in the year) and the program returns the date by specifying the month and day. For instance, Enter a number from 1 to 365: 100 Date: April…
-3
votes
1 answer

Find the difference between two dates (Inclusive of start and end date) in Java

I need to find the difference between two dates in Java and the difference should be inclusive of start and end date. I tried using below piece of code but it is not including start and end date. long diffDays = Days.daysBetween(new…
Vijay
  • 19
  • 1
  • 5