View Problem

Parse a date and time from a string

Given the string "2008-05-06 13:29", parse it as a date representing 6th March, 2008 1:29:00pm in the local time zone.
ExpandDiskEdit
ruby
# With timezone info
puts Time.parse('2008-05-06 13:29')
DiskEdit
csharp
DateTime parsedDate = DateTime.Parse("2008-05-06 13:29");
// Ideally, you would catch the potential FormatException or use DateTime.TryParse in production code.
ExpandDiskEdit
fantom
dt := DateTime.fromLocale("2008-05-06 13:29", "YYYY-MM-DD hh:mm")

Submit a new solution for ruby, csharp, or fantom
There are 17 other solutions in additional languages (clojure, cpp, erlang, fsharp ...)