示例#1
0
        HMS IParser.parse(Object input)
        {
            DateTime dt = (DateTime)input;

            HMS output = new HMS();

            output.hour   = dt.Hour;
            output.minute = dt.Minute;
            output.second = dt.Second;

            return(output);
        }
示例#2
0
        /// <summary>
        /// Contains the code to extract the hours, minutes, and seconds out of a clock.
        /// </summary>
        /// <param name="o">the date object</param>
        /// <returns></returns>
        HMS IParser.parse(Object o)
        {
            try
            {
                string input = (string)o;

                char[] delim  = { ':' };
                HMS    output = new HMS();

                string[] parts = input.Split(delim);

                output.hour   = Int32.Parse(parts[0]);
                output.minute = Int32.Parse(parts[1]);
                output.second = Int32.Parse(parts[2]);

                return(output);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#3
0
        public string parse(Object rawDate)
        {
            HMS hms = this.parser.parse(rawDate);

            return(show(hms.hour, hms.minute, hms.second));
        }