System.Convert.ToDateTime(ulong)

Here are the examples of the csharp api System.Convert.ToDateTime(ulong) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

19 Source : BasicConvert.Overload.cs
with MIT License
from Dogwei

DateTime IXConverter<ulong, DateTime>.Convert(ulong value)
			=> Convert.ToDateTime(value);

19 Source : UInt64Extensions.cs
with GNU General Public License v3.0
from ME3Tweaks

public static DateTime ToDateTime(this ulong value)
		{
			return Convert.ToDateTime(value);
		}

19 Source : Bytes.cs
with MIT License
from microsoft

DateTime IConvertible.ToDateTime(IFormatProvider provider)
        {
            return Convert.ToDateTime(this.bytes);
        }

19 Source : TypeConverter.cs
with GNU General Public License v3.0
from Pyrdacor

DateTime IConvertible.ToDateTime(IFormatProvider provider)
        {
            return Convert.ToDateTime(field.UlongValue);
        }

19 Source : fsDateConverter.cs
with Creative Commons Zero v1.0 Universal
from Touhma

public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType)
        {
            if (data.IsString == false)
                return fsResult.Fail("Date deserialization requires a string, not " + data.Type);

            if (storageType == typeof(DateTime))
            {
                DateTime result;
                if (DateTime.TryParse(data.replacedtring, null, DateTimeStyles.RoundtripKind, out result))
                {
                    instance = result;
                    return fsResult.Success;
                }

                // DateTime.TryParse can fail for some valid DateTime instances.
                // Try to use Convert.ToDateTime.
                if (fsGlobalConfig.AllowInternalExceptions)
                    try
                    {
                        instance = Convert.ToDateTime(data.replacedtring);
                        return fsResult.Success;
                    }
                    catch (Exception e)
                    {
                        return fsResult.Fail("Unable to parse " + data.replacedtring + " into a DateTime; got exception " + e);
                    }

                return fsResult.Fail("Unable to parse " + data.replacedtring + " into a DateTime");
            }

            if (storageType == typeof(DateTimeOffset))
            {
                DateTimeOffset result;
                if (DateTimeOffset.TryParse(data.replacedtring, null, DateTimeStyles.RoundtripKind, out result))
                {
                    instance = result;
                    return fsResult.Success;
                }

                return fsResult.Fail("Unable to parse " + data.replacedtring + " into a DateTimeOffset");
            }

            if (storageType == typeof(TimeSpan))
            {
                TimeSpan result;
                if (TimeSpan.TryParse(data.replacedtring, out result))
                {
                    instance = result;
                    return fsResult.Success;
                }

                return fsResult.Fail("Unable to parse " + data.replacedtring + " into a TimeSpan");
            }

            throw new InvalidOperationException("FullSerializer Internal Error -- Unexpected deserialization type");
        }

19 Source : CommonUtil.cs
with Apache License 2.0
from yuzd

public static long GetFileLastWriteTime(DateTime date)
        {
            return (long)(date - Convert.ToDateTime("1970-1-1", CultureInfo.InvariantCulture)).TotalSeconds;
        }

19 Source : CommonUtil.cs
with Apache License 2.0
from yuzd

public static DateTime GetFileTime(long num)
        {
            return Convert.ToDateTime("1970-1-1").AddSeconds((double)num);
        }