TransWikia.com

I doesn't receive any formated data from static class

Stack Overflow Asked by asfdasfdsfdfsd on December 21, 2020

So I getting some unix timestamp data from ViewModel, but I’d like to converse that data into actuall Date, so I’ve wrote this method in static class:

public class DateFormater {

public static String formatDate(long unixDate ,String formatedDate){
    SimpleDateFormat dateTimeFormat = new SimpleDateFormat("EEEE dd.MM");
    return formatedDate = dateTimeFormat.format(unixDate * 1000L);
 }
}

Here’s the question – why the String formatedDate is empty, whenever I call the method inside the ViewModel observe?

ViewModel.getData().observe(this, new Observer<Model>() {
        @Override
        public void onChanged(Model Model) {

            mUnixDateTime = Model.getCurrent().getDateTime();
            DateFormater.formatDate(unix, formated);
        }
    });
}

*The "unix" is an long variable, and the formated is an String.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP