从当天0点到现在的时间轴集合(小时为单位)

package com.test;

import java.util.ArrayList;
import java.util.List;

import com.common.DataUtils;

public class QueryTest {

    public static void main(String[] args) {
        List<Integer> xDataLine = new ArrayList<Integer>(); // 时间轴每小时
        // 时间轴
        Long size = DataUtils.getLong(com.avatar.gdk.util.DateUtils.getCurrentTime("HH"))+1;
        for (int i = 0; i < size; i++) {
            xDataLine.add(i);
        }
        System.out.println(xDataLine);
        // 现在时间是 11:40
        // 结果为 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
    }
}


猜你喜欢

转载自blog.csdn.net/diyu122222/article/details/78539236