Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I just want to add the 3 days to the current date and print the new date in hive query using java..
please help me out
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.add(Calendar.DATE, 3);
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
How can I get the current date and time and how can I transfer it into the following String format?
06-04-2020 05:00 PM
After that I need to add few minutes to the date? Please help!
Your answer should look something like this:
String dateTimePattern = "dd-MM-yyyy HH:mm a";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateTimePattern );
LocalDateTime yourDay= LocalDateTime.of(2020, 4, 6, 17, 00);
System.out.println(formatter.format(ZonedDateTime.of(yourDay, ZoneId.of("UTC-5"))));
Please look this up for more info on the available formats.
Date yourDate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy h:m a");
String formatedDate= sdf.format(yourDate);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have two times start time and end times and I put it in JodaTime Local time as this :
LocalTime localStartTime = new LocalTime( hoursStartTimeInt, minutesStartTimeInt);
LocalTime localEndTime = new LocalTime( hoursEndTimeInt, minutesEndTimeInt);
I want to compare if these times are between 12:00 - 06:00. please help thanks.
You can create two LocalTime for 12:00 and 06:00 and compare it with your start and end time, like this:
LocalTime localStartTime = new LocalTime( hoursStartTimeInt, minutesStartTimeInt);;
LocalTime localEndTime = new LocalTime( hoursEndTimeInt, minutesEndTimeInt);;
LocalTime twelveTime = new LocalTime(12,0);
LocalTime sixTime = new LocalTime(06,0);
localStartTime.isAfter(twelveTime);
localStartTime.isBefore(sixTime);
localEndTime.isAfter(twelveTime);
localEndTime.isBefore(sixTime);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I found answer to hijri date in Islamic calendar but the code is very complex.
The Question
is there simple function to get it as DateTime type ?
Try using the Joda-Time API IslamicChronology. It's not part of the Android API, download the JAR and add it to your build path to use it in Android projects.
See Joda-Time documentation for Islamic calendar system.
Example code taken from that documentation:
// setup date object for midday on May Day 2004 (ISO year 2004)
DateTime dtISO = new DateTime(2004, 5, 1, 12, 0, 0, 0);
// find out what the same instant is using the Islamic Chronology
DateTime dtIslamic = dtISO.withChronology(IslamicChronology.getInstance());
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i want to have FirstDay of week and last Day of week into the Date Format means i need whole Week date in java using DateChooser means i need to have that whole Existing week for that date. show how to get it i trying to have that logic.
Please Help me and thank you in advance for your Response..
You can use the Calendar class.
Calendar cal = Calendar.getInstance ();
int dayofWeek = cal.get (Calendar.DAY_OF_WEEK);
cal.add (Calendar.DATE, -1 * (dayofWeek - Calendar.MONDAY));
Date fdow = cal.getTime ();
As the cal object is now modified, just add six to get the last day of the week.
cal.add (Calendar.DATE, 6);
Date ldow = cal.getTime ();
Using the third-party Joda-Time makes it a bit easier.
See the question Get first day of a particular week in Joda-Time? java.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
My input is in the format of Sep 22, 2008 and how to convert it into 9/22/2008 using JAVA?
Do like this
Date date = new SimpleDateFormat("MMM d, yyyy").parse("Sep 22, 2008");
String formattedDate = new SimpleDateFormat("MM/dd/yyyy").format(date);
System.out.println(formattedDate);
output
09/22/2008