示例#1
0
        /// <summary>
        /// Returns the value of the requested column as a DateTime
        /// </summary>
        /// <returns>The DateTime.</returns>
        /// <param name="cursor">Cursor.</param>
        /// <param name="column">Column name.</param>
        /// <param name="allDay">Whether the event is all-day</param>
        public static DateTime GetDateTime(this ICursor cursor, string column, bool allDay)
        {
            var ms = cursor.GetLong(cursor.GetColumnIndex(column));

            var dt = DateConversions.GetDateFromAndroidMS(ms);

            // All day events should not be affected by time zones, so we simply take the
            // UTC time and treat it as local (e.g., Christmas doesn't start on the 24th in California...)
            //
            return(allDay ? DateTime.SpecifyKind(dt.ToUniversalTime(), DateTimeKind.Local) : dt.ToLocalTime());
        }
示例#2
0
        /// <summary>
        /// Returns the value of the requested column as a DateTime
        /// </summary>
        /// <returns>The DateTime.</returns>
        /// <param name="cursor">Cursor.</param>
        /// <param name="column">Column name.</param>
        public static DateTime GetDateTime(this ICursor cursor, string column)
        {
            var ms = cursor.GetLong(cursor.GetColumnIndex(column));

            return(DateConversions.GetDateFromAndroidMS(ms));
        }