/// <summary> /// Try to get the datetime from an object. /// </summary> /// <param name="value">Object to try to parse.</param> /// <returns>The parsed datetime or null.</returns> public static DateTime?GetDateTimeNullable(object value) { DateTime currentDateTime = DateTime.UtcNow; DateTime newDateTime = DateTime.UtcNow; Boolean parse = DateTime.TryParse(HString.ToString(value), out newDateTime); return(parse ? (DateTime?)newDateTime : null); }
/// <summary> /// Safely trims a string from object. /// </summary> /// <param name="value">The object to set string and trim.</param> /// <returns></returns> public static String SafeTrim(Object value) { return(value != null?HString.ToString(value).Trim() : String.Empty); }