DateTime.createFromFormat C# (CSharp) Méthode

createFromFormat() public static méthode

public static createFromFormat ( Context ctx, string format, string time, DateTimeZone, timezone = null ) : object
ctx Context
format string
time string
timezone DateTimeZone,
Résultat object
    public static object createFromFormat(Context ctx, string format, string time, DateTimeZone timezone = null)
    {
        // arguments
        var tz = (timezone != null) ? timezone.timezone : PhpTimeZone.GetCurrentTimeZone(ctx);

        if (format == null)
        {
            //PhpException.InvalidArgument("format");
            //return false;
            throw new ArgumentNullException();
        }

        if (time == null)
        {
            //PhpException.InvalidArgument("time");
            //return false;
            throw new ArgumentNullException();
        }

        // create DateTime from format+time
        int i = 0;  // position in <timestr>
        foreach (var c in format)
        {
            switch (c)
            {
                //case 'd':
                //case 'j':
                //    var day = PHP.Library.StrToTime.DateInfo.ParseUnsignedInt(timestr, ref i, 2);
                //    // ... use day
                //    break;
                //case 'F':
                //case 'M':
                //    // parse  ...
                //    break;
                default:
                    if (i < time.Length && time[i] == c)
                    {
                        // match
                        i++;
                    }
                    else
                    {
                        // not match
                        //PhpException.InvalidArgument("time");   // time not matching format
                        //return false;
                        throw new ArgumentException();
                    }
                    break;
            }
        }

        if (i < time.Length)
        {
            //PhpException.InvalidArgument("time");   // time not matching format
            //return false;
            throw new ArgumentException();
        }

        ////
        //return new __PHP__DateTime(context, true)
        //{
        //     //Time = new DateTime(year, month, day, hour, minute, second, millisecond),
        //     TimeZone = tz,
        //};

        throw new NotImplementedException();
    }