What is the way to show the time like 16:02:08
coz now i see the time like this 16:2:8
i dont understand whats the issue for that .
in this example i try display the current time and its display it with no the "zeros" and
i dont understand why its like that .
i try many things but it didnt works and I would be happy to some help with this issue .
function NetuneyDigum() {
const [currentTime, setCurrentTime] = useState("");
return (
<>
<View
style={{
flex: 1,
alignItems: 'center',
backgroundColor: '#cbced4',
}}
>
<View
style={{
paddingTop: 30,
flexDirection: 'row',
paddingRight: 180,
}}
>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
left: 58,
}}
>
<Text
style={{
fontWeight: 'bold',
fontSize: 18,
color: 'black',
}}
>
THE TIME IS: {currentTime}
</Text>
</View>
<View
style={{
width: 150,
borderRadius: 5,
borderColor: 'black',
borderWidth: 2,
left: 80,
}}
></View>
<TouchableOpacity
onPress={()=>{
const today = new Date(),
time = today.getHours() + ':' + today.getMinutes() + ':' + today.getSeconds();
setCurrentTime(time);
}}
style={{
height: 60,
width: 60,
borderRadius: 5,
borderColor: 'black',
borderWidth: 2,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'red',
left: 100,
}}
>
<Icon name="md-time" size={50} color="black" />
</TouchableOpacity>
</View>
</View>
</>
);
}