Пример #1
0
 public SDLDateTime(DateTime dateTime, string timeZone)
 {
     this.dateTime = dateTime;
     if (timeZone == null)
     {
         timeZone = SDLDateTime.getCurrentTimeZone();
     }
     this.timeZone = timeZone;
 }
Пример #2
0
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder((string)(object)this.Year + (object)"/");

            if (this.Month < 10)
            {
                stringBuilder.Append("0");
            }
            stringBuilder.Append((string)(object)this.Month + (object)"/");
            if (this.Day < 10)
            {
                stringBuilder.Append("0");
            }
            stringBuilder.Append(this.Day);
            if (this.HasTime)
            {
                stringBuilder.Append(" ");
                if (this.Hour < 10)
                {
                    stringBuilder.Append("0");
                }
                stringBuilder.Append(this.Hour);
                stringBuilder.Append(":");
                if (this.Minute < 10)
                {
                    stringBuilder.Append("0");
                }
                stringBuilder.Append(this.Minute);
                if (this.Second != 0 || this.Millisecond != 0)
                {
                    stringBuilder.Append(":");
                    if (this.Second < 10)
                    {
                        stringBuilder.Append("0");
                    }
                    stringBuilder.Append(this.Second);
                    if (this.Millisecond != 0)
                    {
                        stringBuilder.Append(".");
                        string str = string.Concat((object)this.Millisecond);
                        if (str.Length == 1)
                        {
                            str = "00" + str;
                        }
                        else if (str.Length == 2)
                        {
                            str = "0" + str;
                        }
                        stringBuilder.Append(str);
                    }
                }
                stringBuilder.Append("-");
                stringBuilder.Append(this.TimeZone == null ? SDLDateTime.getCurrentTimeZone() : this.TimeZone);
            }
            return(((object)stringBuilder).ToString());
        }