-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.java
More file actions
29 lines (23 loc) · 936 Bytes
/
Common.java
File metadata and controls
29 lines (23 loc) · 936 Bytes
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
package com.example.weatherapp.Common;
import android.location.Location;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Common {
public static final String API_ID = "8f81757d22bf2c8cd4fdd7dcb9bd0cf1";
public static Location current_location = null;
public static String convertUnixToDate(long dt) {
Date date = new Date(dt*1000L);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm, EEE dd/MM/yyyy");
return sdf.format(date);
}
public static String convertUnixToForecastDate(long dt) {
Date date = new Date(dt*1000L);
SimpleDateFormat sdf = new SimpleDateFormat("EEE dd/MM/yyyy");
return sdf.format(date);
}
public static String convertUnixToHour(long dt) {
Date date = new Date(dt*1000L);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
return sdf.format(date);
}
}