Esempio n. 1
0
        private static DateTime SecondsMidNight2DateTime(int SecondsMidNight, int year, int month, int day)
        {
            int hour, minutes, seconds;

            ModelUtil.SecondsMidNight2Time(SecondsMidNight, out hour, out minutes, out seconds);
            DateTime dateTime = new DateTime(year, month, day, hour, minutes, seconds);

            return(dateTime);
        }
Esempio n. 2
0
        public static List <List <ValAndFieldName> > GenerateListValAndFieldName(List <List <ModelCommon> > data)
        {
            List <List <ValAndFieldName> > valAndFieldNames = new List <List <ValAndFieldName> >();

            foreach (var listModelCommon in data)
            {
                List <ValAndFieldName> newLine = new List <ValAndFieldName>();
                foreach (var model in listModelCommon)
                {
                    newLine.AddRange(ModelUtil.FieldToValAndFieldArray(model));
                }
                valAndFieldNames.Add(newLine);
            }
            return(valAndFieldNames);
        }
Esempio n. 3
0
        //从filenpath中获取,这就要求文件夹必须一天一个
        public static DateTime ProcessSecondMidNight(String filepath, int secondsMidNight)
        {
            if (!Regex.IsMatch(filepath, @"\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}"))
            {
                throw new Exception("filepath don't have date");
            }
            var      match = Regex.Match(filepath, @"\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}");
            DateTime d     = DateTime.ParseExact(match.Value, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture);


            int hour, minutes, seconds;

            ModelUtil.SecondsMidNight2Time(secondsMidNight, out hour, out minutes, out seconds);
            DateTime dateTime = new DateTime(d.Year, d.Month, d.Day, hour, minutes, seconds);

            return(dateTime);
        }