解析时间，格式HH:mm:ss，默认为1970-01-01

@param timeString 标准形式的日期字符串
@return 日期对象
777980
public static DateTime parseTime(String timeString) {
		timeString = normalize(timeString);
		return parse(timeString, DatePattern.NORM_TIME_FORMAT);
	}
211733
public Date toDate(String dateString) {
        Date date = null;
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        try {
            date = df.parse(dateString);
        } catch (ParseException ex) {
            System.out.println(ex.fillInStackTrace());
        }
        return date;
    }
761192
public static String getDateStr(Date date) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(date);
    }
895885
function getIso8601String(timeMs) {
  var time = new Date();
  time.setTime(timeMs);
  return '' +
      time.getUTCFullYear() + '-' +
      leftPadNumber(time.getUTCMonth() + 1, 2, '0') + '-' +
      leftPadNumber(time.getUTCDate(), 2, '0') + 'T' +
      leftPadNumber(time.getUTCHours(), 2, '0') + ':' +
      leftPadNumber(time.getUTCMinutes(), 2, '0') + ':' +
      leftPadNumber(time.getUTCSeconds(), 2, '0') + 'Z';
}
97944
function stringToMs(str){
   let summ = 0, time, type, value;
   let time_list = ('' + str).split(' ').filter(v => v != '' && /^(\d{1,}\.)?\d{1,}([wdhms])?$/i.test(v));

   for(let i = 0, len = time_list.length; i < len; i++){
      time = time_list[i];
      type = time.match(/[wdhms]$/i);

      if(type){
         value = Number(time.replace(type[0], ''));

         switch(type[0].toLowerCase()){
            case 'w':
               summ += value * 604800000;
            break;
            case 'd':
               summ += value * 86400000;
            break;
            case 'h':
               summ += value * 3600000;
            break;
            case 'm':
               summ += value * 60000;
            break;
            case 's':
               summ += value * 1000;
            break;
         }
      }else if(!isNaN(parseFloat(time)) && isFinite(time)){
         summ += parseFloat(time);
      }
   }
   return summ;
}
516003
public static DateTime parseDate(String dateString) {
		dateString = normalize(dateString);
		return parse(dateString, DatePattern.NORM_DATE_FORMAT);
	}
33808
function( timeString, format ) {

			this.setFormat(format);
			this.clearTimeZone();
			var parts = [];

			if(timeString.toLowerCase() === 'z'){
				this.z = true;
				// set case for z
				this.autoProfile.tzZulu = (timeString === 'z')? 'z' : 'Z';
			}else{

				// discover timezone separtor for auto profile // default is ':'
				if(timeString.indexOf(':') === -1) {
					this.autoProfile.tzsep = '';
				}

				// finds timezone +HH:MM and +HHMM  ie +13:30 and +1330
				parts = timeString.match( /([\-\+]{1})?(\d\d)?:?(\d\d)?/ );
				if(parts[1]) {
					this.tzPN = parts[1];
				}
				if(parts[2]) {
					this.tzH = parts[2];
				}
				if(parts[3]) {
					this.tzM = parts[3];
				}


			}
			this.tzZulu = 'z';
			return this.toTimeString( this.format );
		}
966409
def parse_hh_mm_ss(self):
        
        split_count = self.raw.count(":")

        if split_count == 2:  # hh:mm:ss
            return datetime.strptime(str(self.raw).strip(), "%H:%M:%S").time()
        elif split_count == 1:  # mm:ss
            return datetime.strptime(str(self.raw).strip(), "%M:%S").time()

        return datetime.strptime(str(self.raw).strip(), "%S").time()
503657
private static double parseISOString(String s) {
        // we use a simple state machine to parse the input string
        final int ERROR = -1;
        final int YEAR = 0, MONTH = 1, DAY = 2;
        final int HOUR = 3, MIN = 4, SEC = 5, MSEC = 6;
        final int TZHOUR = 7, TZMIN = 8;
        int state = YEAR;
        // default values per [15.9.1.15 Date Time String Format]
        int[] values = { 1970, 1, 1, 0, 0, 0, 0, -1, -1 };
        int yearlen = 4, yearmod = 1, tzmod = 1;
        int i = 0, len = s.length();
        if (len != 0) {
            char c = s.charAt(0);
            if (c == '+' || c == '-') {
                // 15.9.1.15.1 Extended years
                i += 1;
                yearlen = 6;
                yearmod = (c == '-') ? -1 : 1;
            } else if (c == 'T') {
                // time-only forms no longer in spec, but follow spidermonkey here
                i += 1;
                state = HOUR;
            }
        }
        loop: while (state != ERROR) {
            int m = i + (state == YEAR ? yearlen : state == MSEC ? 3 : 2);
            if (m > len) {
                state = ERROR;
                break;
            }

            int value = 0;
            for (; i < m; ++i) {
                char c = s.charAt(i);
                if (c < '0' || c > '9') { state = ERROR; break loop; }
                value = 10 * value + (c - '0');
            }
            values[state] = value;

            if (i == len) {
                // reached EOF, check for end state
                switch (state) {
                case HOUR:
                case TZHOUR:
                    state = ERROR;
                }
                break;
            }

            char c = s.charAt(i++);
            if (c == 'Z') {
                // handle abbrevation for UTC timezone
                values[TZHOUR] = 0;
                values[TZMIN] = 0;
                switch (state) {
                case MIN:
                case SEC:
                case MSEC:
                    break;
                default:
                    state = ERROR;
                }
                break;
            }

            // state transition
            switch (state) {
            case YEAR:
            case MONTH:
                state = (c == '-' ? state + 1 : c == 'T' ? HOUR : ERROR);
                break;
            case DAY:
                state = (c == 'T' ? HOUR : ERROR);
                break;
            case HOUR:
                state = (c == ':' ? MIN : ERROR);
                break;
            case TZHOUR:
                // state = (c == ':' ? state + 1 : ERROR);
                // Non-standard extension, https://bugzilla.mozilla.org/show_bug.cgi?id=682754
                if (c != ':') {
                    // back off by one and try to read without ':' separator
                    i -= 1;
                }
                state = TZMIN;
                break;
            case MIN:
                state = (c == ':' ? SEC : c == '+' || c == '-' ? TZHOUR : ERROR);
                break;
            case SEC:
                state = (c == '.' ? MSEC : c == '+' || c == '-' ? TZHOUR : ERROR);
                break;
            case MSEC:
                state = (c == '+' || c == '-' ? TZHOUR : ERROR);
                break;
            case TZMIN:
                state = ERROR;
                break;
            }
            if (state == TZHOUR) {
                // save timezone modificator
                tzmod = (c == '-') ? -1 : 1;
            }
        }

        syntax: {
            // error or unparsed characters
            if (state == ERROR || i != len) break syntax;

            // check values
            int year = values[YEAR], month = values[MONTH], day = values[DAY];
            int hour = values[HOUR], min = values[MIN], sec = values[SEC], msec = values[MSEC];
            int tzhour = values[TZHOUR], tzmin = values[TZMIN];
            if (year > 275943 // ceil(1e8/365) + 1970 = 275943
                || (month < 1 || month > 12)
                || (day < 1 || day > DaysInMonth(year, month))
                || hour > 24
                || (hour == 24 && (min > 0 || sec > 0 || msec > 0))
                || min > 59
                || sec > 59
                || tzhour > 23
                || tzmin > 59
               ) {
                break syntax;
            }
            // valid ISO-8601 format, compute date in milliseconds
            double date = date_msecFromDate(year * yearmod, month - 1, day,
                                            hour, min, sec, msec);
            if (tzhour == -1) {
                // Spec says to use UTC timezone, the following bug report says
                // that local timezone was meant to be used. Stick with spec for now.
                // https://bugs.ecmascript.org/show_bug.cgi?id=112
                // date = internalUTC(date);
            } else {
                date -= (tzhour * 60 + tzmin) * msPerMinute * tzmod;
            }

            if (date < -HalfTimeDomain || date > HalfTimeDomain) break syntax;
            return date;
        }

        // invalid ISO-8601 format, return NaN
        return ScriptRuntime.NaN;
    }
711351
public static String timeStampToString(final Timestamp timestamp, final String format) {
        return dateToString(new Date(timestamp.getTime()), format);
    }
1215930
static public String getSFTimeAsString(
      SFTime sft, int scale, SnowflakeDateTimeFormat timeFormatter)
  {
    return timeFormatter.format(sft, scale);
  }
955416
def date_time_string(self, timestamp=None):
        """"""
        if timestamp is None:
            timestamp = time.time()
        year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
        s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
                self.weekdayname[wd],
                day, self.monthname[month], year,
                hh, mm, ss)
        return s
486560
function parseISO8601(str) {
    if (Date.prototype.toISOString) {
        return new Date(str);
    } else {
        var parts = str.split('T'),
            dateParts = parts[0].split('-'),
            timeParts = parts[1].split('Z'),
            timeSubParts = timeParts[0].split(':'),
            timeSecParts = timeSubParts[2].split('.'),
            timeHours = Number(timeSubParts[0]),
            _date = new Date();

        _date.setUTCFullYear(Number(dateParts[0]));
        _date.setUTCDate(1);
        _date.setUTCMonth(Number(dateParts[1])-1);
        _date.setUTCDate(Number(dateParts[2]));
        _date.setUTCHours(Number(timeHours));
        _date.setUTCMinutes(Number(timeSubParts[1]));
        _date.setUTCSeconds(Number(timeSecParts[0]));
        if (timeSecParts[1]) {
            _date.setUTCMilliseconds(Number(timeSecParts[1]));
        }

        return _date;
    }
}
460215
def unixtime2str(timestamp, fmt='%Y-%m-%d %H:%M:%S'):
    
    dt = None
    try:
        timestamp = time.localtime(timestamp)
        dt = time.strftime(fmt, timestamp)
    except Exception as err:
        print(err)
    return dt
640905
public static String convertDateToTimeString(Date date) {
		if (date == null) {
			return null;
		} else {
			// DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS'Z'");
			DateTimeFormatter df = FORMATTER_SECONDS_Z;
			return df.print(date.getTime());
		}
	}
556375
private static String tempDateStringForJodaTime(String dateString) {
        final String fromPrefix = "292278994-";
        final String toPrefix   = "292278993-";
        return dateString.startsWith(fromPrefix)
             ? toPrefix + dateString.substring(fromPrefix.length())
             : dateString;
    }
1311974
public static String toMediaWikiString(Timestamp timestamp){
		String original = timestamp.toString();
		StringBuffer result = new StringBuffer();
		result.append(original.substring(0,4));//year
		result.append(original.substring(5,7));//month
		result.append(original.substring(8,10));//date
		result.append(original.substring(11,13));//hour
		result.append(original.substring(14,16));//minute
		result.append(original.substring(17,19));//second
		return result.toString();
	}