Go language program to convert days to milliseconds

Views: 16   

Following program shows you how to convert days to milliseconds.
In this program we get days from user once we get those we need to multiply with 24 so that we get in hours, once we get hours we need to multiply with 60 so that we get in mintues, once we get mintues we need to multiply with 60 so that we get in seconds, once we get seconds we need to multiply with 1000 so that we get in milliseconds

package main

import "fmt"

func main() {

  var days int
  var milliseconds int
  fmt.Println("Please enter days:")
  fmt.Scanf("%d", &days)
  milliseconds = days * 24 * 60 * 60 * 1000
  fmt.Println(milliseconds , " Milliseconds")
}

Output:

Please enter days:
 2
172800000  Milliseconds
On By