Java 8 Innards Date and Time API
Java 8 Innards Date and Time API
return d.format(f).toString();
}
}
--------------------------------------------------------------------------------
m
------
er as
--------------------------------------------------------------------------------
co
------
eH w
################ 2. Java 8 Innards - Date And Time API - Temporal
Adjuster################
o.
import java.util.*; rs e
class TemporalAdjusterSolution
ou urc
{
public static String friendShipDay(int inputYear) {
//Write your code here
LocalDate d= LocalDate.of(inputYear,7,31);
o
LocalDate today=d.with(TemporalAdjusters.next(DayOfWeek.SUNDAY));
aC s
DateTimeFormatter f=DateTimeFormatter.ofPattern("dd-MM-yyyy");
v i y re
return today.format(f).toString();
}
}
--------------------------------------------------------------------------------
ed d
------
ar stu
--------------------------------------------------------------------------------
------
################3. Java 8 Innards - Date And Time API - Muharram
Month################
import java.util.*;
sh is
class MuharramMonthStartEnd {
public static String MuharramMonthStartDate(int inputYear) {
Th
This study source was downloaded by 100000821315344 from CourseHero.com on 09-18-2021 16:11:41 GMT -05:00
https://www.coursehero.com/file/87135370/Java-8-Innards-Date-And-Time-APItxt/
AR,1);
d=d.from(h.with(TemporalAdjusters.lastDayOfMonth()));
DateTimeFormatter f= DateTimeFormatter.ofPattern("dd-MM-yyyy");
return d.format(f).toString();
}
}
--------------------------------------------------------------------------------
------
--------------------------------------------------------------------------------
------
m
int mmm=Integer.parseInt(stringInputDate.split("-")[1]);
er as
int dd=Integer.parseInt(stringInputDate.split("-")[2]);
co
String stringInputTime=inputDateTime.split(" ")[1];
eH w
int hh=Integer.parseInt(stringInputTime.split(":")[0]);
int mm=Integer.parseInt(stringInputTime.split(":")[1]);
o.
int ss=Integer.parseInt(stringInputTime.split(":")[2]);
rs e
LocalDateTime d=LocalDateTime.of(yy,mmm,dd,hh,mm,ss);
ou urc
ZonedDateTime zone=d.atZone(ZoneId.of("Asia/Kolkata"));
String []a=new String[n];
for(int i=0;i<n;i++)
{
o
ZonedDateTime z1=zone.withZoneSameInstant(ZoneId.of(inputZones[i]));
aC s
a[i]=z1.toString();
v i y re
}
return a;
}
}
ed d
ar stu
sh is
Th
This study source was downloaded by 100000821315344 from CourseHero.com on 09-18-2021 16:11:41 GMT -05:00
https://www.coursehero.com/file/87135370/Java-8-Innards-Date-And-Time-APItxt/
Powered by TCPDF (www.tcpdf.org)