Beispiel #1
0
        /// <summary>Create a new Git oriented date formatter</summary>
        /// <param name="format"></param>
        public GitDateFormatter(GitDateFormatter.Format format)
        {
            this.format = format;
            switch (format)
            {
            default:
            {
                break;
                break;
            }

            case GitDateFormatter.Format.DEFAULT:
            {
                // Not default:
                dateTimeInstance = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy Z", CultureInfo
                                                        .InvariantCulture);
                break;
            }

            case GitDateFormatter.Format.ISO:
            {
                dateTimeInstance = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", CultureInfo.InvariantCulture
                                                        );
                break;
            }

            case GitDateFormatter.Format.LOCAL:
            {
                dateTimeInstance = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy", CultureInfo.InvariantCulture
                                                        );
                break;
            }

            case GitDateFormatter.Format.RFC:
            {
                dateTimeInstance = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", CultureInfo
                                                        .InvariantCulture);
                break;
            }

            case GitDateFormatter.Format.SHORT:
            {
                dateTimeInstance = new SimpleDateFormat("yyyy-MM-dd", CultureInfo.InvariantCulture
                                                        );
                break;
            }

            case GitDateFormatter.Format.LOCALE:
            case GitDateFormatter.Format.LOCALELOCAL:
            {
                SystemReader systemReader = SystemReader.GetInstance();
                dateTimeInstance = systemReader.GetDateTimeInstance(DateFormat.DEFAULT, DateFormat
                                                                    .DEFAULT);
                dateTimeInstance2 = systemReader.GetSimpleDateFormat("Z");
                break;
            }
            }
        }