Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Date;

import android.text.TextUtils;

public class Main {
    private static final long IG_MEDIA_PHOTOS_RANGE = 2 * 24 * 60 * 60 * 1000;

    public static boolean isMediaInDateRange(String mediaTimeStamp) {

        if (!TextUtils.isEmpty(mediaTimeStamp)) {
            Date currentDate = new Date();
            long mediaDateLong = Long.valueOf(mediaTimeStamp) * 1000L;
            long diff = currentDate.getTime() - mediaDateLong;
            if (diff < IG_MEDIA_PHOTOS_RANGE) {
                return true;
            }
        }
        return false;
    }
}