String
"2011-05-19 10:30:14"
To
Thu May 19 10:30:14 UTC 2011
How can I convert specific string to this Date format ?
Print(s. ToString("MMM d, yyyy"); debug. Print(s. ToString("HH:mm:ss dddd");
Using strptime() , date and time in string format can be converted to datetime type. The first parameter is the string and the second is the date time format specifier. One advantage of converting to date format is one can select the month or date or time individually.
open System let convertToDateTime (value: string) = try let convertedDate = Convert. ToDateTime value printfn $"'{value}' converts to {convertedDate} {convertedDate.
require 'date' date = DateTime.parse("2011-05-19 10:30:14") formatted_date = date.strftime('%a %b %d %H:%M:%S %Z %Y')
See strftime() for more information about formatting dates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With