Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Xaml Converter to display dates on local UTC time
using System;
using Windows.UI.Xaml.Data;
namespace ElBruno.UI.Converters
{
public class UtcToLocalDateTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return DateTime.SpecifyKind(DateTime.Parse(value.ToString()), DateTimeKind.Utc).ToLocalTime();
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment