-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestaurantProperties.java
86 lines (68 loc) · 2.41 KB
/
RestaurantProperties.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package com.wolt.devname.restaurantopeninghours;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
public class RestaurantProperties {
private String openingTime;
private String closingTime;
private String theType;
private String theNewDay;
private String theSpecialDay;
private boolean jsonArrayLengthEqOne = false;
private boolean jsonArrayLengthGrTwo = false;
public void setJsonArrayLengthEqOne(boolean jsonArrayLengthEqOne){
this.jsonArrayLengthEqOne = jsonArrayLengthEqOne;
}
public boolean getJsonArrayLengthEqOne(){
return jsonArrayLengthEqOne;
}
public void setJsonArrayLengthGrTwo(boolean jsonArrayLengthGrTwo){
this.jsonArrayLengthGrTwo = jsonArrayLengthGrTwo;
}
public boolean getJsonArrayLengthGrTwo(){
return jsonArrayLengthGrTwo;
}
public void setSpecialDay(String theSpecialDay){
this.theSpecialDay = theSpecialDay;
}
public String getSpecialDay(){
return theSpecialDay;
}
public void setNewDay(String theNewDay){
this.theNewDay = theNewDay;
}
public String getNewDay(){
return theNewDay;
}
public void setTheType(String theType){
this.theType = theType;
}
public String getTheType(){
return theType;
}
public void setOpeningTime(String openingTime){
this.openingTime = timeConverter(openingTime);
}
public String getOpeningTime(){
return openingTime;
}
public void setClosingTime(String closingTime){
this.closingTime = timeConverter(closingTime);
}
public String getClosingTime(){
return closingTime;
}
public String timeConverter(String unixTime) {
Calendar calendar = Calendar.getInstance();
TimeZone timeZone = TimeZone.getDefault();
long timeIs = Long.valueOf(unixTime) * 1000;
calendar.setTimeInMillis(timeIs * 1000);
calendar.add(Calendar.MILLISECOND, timeZone.getOffset(calendar.getTimeInMillis()));
Date dateformat = new java.util.Date(timeIs);
SimpleDateFormat formatToReq = new SimpleDateFormat("h a");
formatToReq.setTimeZone(TimeZone.getTimeZone("GMT"));
String convertedTime = formatToReq.format(dateformat);
return convertedTime;
}
}