EMsnap commented on code in PR #9288: URL: https://github.com/apache/inlong/pull/9288#discussion_r1392489879
########## inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/DateTransUtils.java: ########## @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.agent.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +public class DateTransUtils { + + private static final Logger logger = LoggerFactory.getLogger(DateTransUtils.class); + + // convert millSec to YYYMMDD by cycleUnit + public static String millSecConvertToTimeStr(long time, String cycleUnit) { + return millSecConvertToTimeStr(time, cycleUnit, TimeZone.getDefault()); + } + + // convert YYYMMDD to millSec by cycleUnit + public static long timeStrConvertTomillSec(String time, String cycleUnit) + throws ParseException { + return timeStrConvertTomillSec(time, cycleUnit, TimeZone.getDefault()); + } + + public static long timeStrConvertTomillSec(String time, String cycleUnit, TimeZone timeZone) + throws ParseException { + long retTime = 0; + // SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Review Comment: remove this please -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
