I have this date in F #
let myDate = new DateTime(2015, 06, 02)
And I want to display it as "2015/06/02" in the console window. I tried:
Console.WriteLine(sprintf "%s" myDate.ToString("yyyy/MM/dd"))
But this does not compile (the compiler says: "Consecutive arguments must be separated by spaces or alternating, and arguments with applications of functions or methods must be enclosed in brackets")
How to display date as "2015/06/02"?
UPDATE:
As Panagiotis Kanavos commented, this will work:
Console.WriteLine("{0:yyyy/MM/dd}", myDate)
source
share