Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created May 15, 2017 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/80a9168ae65508101730a0c7a2fd9b64 to your computer and use it in GitHub Desktop.
Save elbruno/80a9168ae65508101730a0c7a2fd9b64 to your computer and use it in GitHub Desktop.
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