From 8a7ab0b7a1398d9bcd9168f4824c067922ac125d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A3=AF=E9=87=8E?= Date: Fri, 12 Jan 2024 12:23:22 +0900 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E4=BB=98=E3=82=92=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/childguard/MainActivity.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/com/example/childguard/MainActivity.java b/app/src/main/java/com/example/childguard/MainActivity.java index 3b4f32c..4de4695 100644 --- a/app/src/main/java/com/example/childguard/MainActivity.java +++ b/app/src/main/java/com/example/childguard/MainActivity.java @@ -6,6 +6,7 @@ import androidx.core.app.ActivityCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; +import android.annotation.SuppressLint; import android.app.NotificationChannel; import android.app.NotificationManager; import android.bluetooth.BluetoothAdapter; @@ -17,6 +18,9 @@ import android.os.Vibrator; import com.google.android.material.bottomnavigation.BottomNavigationView; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.Random; import java.util.UUID; @@ -25,6 +29,13 @@ public class MainActivity extends AppCompatActivity { BluetoothManager bluetoothManager; BluetoothAdapter bluetoothAdapter; + //↓日付を取得するやつ + public static String getNowDate() { + @SuppressLint("SimpleDateFormat") final DateFormat df = new SimpleDateFormat("yyy/MM/dd HH:mm:ss"); + final Date date = new Date(System.currentTimeMillis()); + return df.format(date); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);