We help IT Professionals succeed at work.
Get Started

Need to display current day,previous day,last twodays data in my code using java

srikotesh asked
Last Modified: 2016-01-28
Hi Experts,

i want to display list values based on now(current day),last day(current date+previous day),last two days.
List<PerformanceDataValues> dataList = new ArrayList<>();
                for (Entry<String, String> entry : treemap.entrySet()) {
                    PerformanceDataValues data = new PerformanceDataValues();
                    String value = entry.getValue();
                    String computedValue = applyFormula(value, wsdlInput.getFormulae());
                    data.setValue(computedValue != null ? computedValue : value);

Open in new window

this list will have values as below,
every time this list will have last 3 days data.
i want to display 3 different outputs

a) days as 0
i have to display current date---> time and values information

b) days as 1
i have to display current day and previous day

c) days as 3

last 3days data

in method parameter i am passing the input value for days.
MeasurementInput input
input.getDays() will give value as 0 or 1 or  2 based on the value i have to show any of the data

dataList sample values:
        "time": "2016-1-10 13:30:00",
        "value": 253.000
        "time": "2016-1-10 13:30:00",
        "value": 53.000
        "time": "2016-1-11 13:30:00",
        "value": 353.000
        "time": "2016-1-11 13:30:00",
        "value": 3.000
        "time": "2015-1-12 13:30:00",
        "value": 30.000
        "time": "2015-1-12 13:30:00",
        "value": 23.000

Watch Question
Sr. Software engineer
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE