I need to convert decimal to string in some specific format
1.0 to "+01:00"
-4.0 to "-04:00"
I have used .toString()
but that is only converting to string as expected how to convert it into above format. Please suggest
I need to convert decimal to string in some specific format
1.0 to "+01:00"
-4.0 to "-04:00"
I have used .toString()
but that is only converting to string as expected how to convert it into above format. Please suggest
2
Answers
You can create a custom function to convert number to your desired format using
padStart
andtoFixed
.