Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.TimeZone;
- public class Current {
- private long mTime;
- private String mSummary;
- private String mIcon;
- private double mTemp;
- private double mPrecip;
- private String mTimeZone;
- public String getTimeZone() {
- return mTimeZone;
- }
- public void setTimeZone(String timeZone) {
- mTimeZone = timeZone;
- }
- public long getTime() {
- return mTime;
- }
- public void setTime(long time) {
- mTime = time;
- }
- public String getFormattedTime(){
- SimpleDateFormat formatter = new SimpleDateFormat("h:mm a");
- formatter.setTimeZone(TimeZone.getTimeZone(getTimeZone()));
- Date datetime = new Date(getTime() * 1000);
- String timeString = formatter.format(datetime);
- return timeString;
- }
- public String getSummary() {
- return mSummary;
- }
- public void setSummary(String summary) {
- mSummary = summary;
- }
- public String getIcon() {
- return mIcon;
- }
- public void setIcon(String icon) {
- mIcon = icon;
- }
- public int getTemp() {
- return (int) Math.round(mTemp);
- }
- public void setTemp(double temp) {
- mTemp = temp;
- }
- public double getPrecip() {
- return mPrecip;
- }
- public void setPrecip(double precip) {
- mPrecip = precip;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment