Skip to content

Commit 9fcb4f5

Browse files
committed
project #7: convert into a standard date format
1 parent 98c03a8 commit 9fcb4f5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

AgeInMinutes/app/src/main/java/com/example/ageinminutes/MainActivity.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.widget.Button
77
import android.widget.TextView
88
import android.widget.Toast
99
import androidx.appcompat.app.AppCompatActivity
10+
import java.text.SimpleDateFormat
1011
import java.util.*
1112

1213
class MainActivity : AppCompatActivity() {
@@ -40,7 +41,12 @@ class MainActivity : AppCompatActivity() {
4041

4142
// get the reference of the text view
4243
val showSelectedDate = findViewById<TextView>(R.id.tvSelectedDate)
43-
showSelectedDate.setText(selectedDate).toString()
44+
// get the values form selected date
45+
showSelectedDate.setText(selectedDate)
46+
// converting the date into a standard format
47+
val formatDate = SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH)
48+
// storing the format date
49+
val theDate = formatDate.parse(selectedDate)
4450
},
4551
year,
4652
month,

0 commit comments

Comments
 (0)