grab the day from the epoch time - Android java.util

Android examples for java.util:Day

Description

grab the day from the epoch time

Demo Code


//package com.java2s;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {
    /**//from  w ww .j a  v a 2 s  .  c o  m
     * Helper function to grab the day from the epoch time
     * 
     * @param timeInMs
     * @return int the day of the week, starting at Sunday = 1, Saturday = 7
     */
    public static int parseDayOfWeek(long timeInMs) {
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTimeInMillis(timeInMs);
        System.out.println("parsedayofweek: "
                + calendar.get(Calendar.DAY_OF_WEEK));
        return calendar.get(Calendar.DAY_OF_WEEK);
    }
}

Related Tutorials