I had some trouble parsing the date strings created by Umbraco’s Date Picker to a System.DateTime object.

Following is a short snippet, which does the trick:

DateTime date = DateTime.ParseExact(
    content.GetPropertyValue<string>("datePropertyAlias"),
    @"M\/d\/yyyy",
    null);

Note that content is an IPublishedContent object.

Categories: Umbraco

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *