I am new in extension development. I am trying to convert seconds in timestamp
please show where I am wrong. *using niotron ide
library
package com.mfd.endtime;
import android.app.Activity;
import android.content.Context;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import java.util.*;
@DesignerComponent(
version = 1,
description = "",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "")
@SimpleObject(external = true)
//Libraries
@UsesLibraries(libraries = "java-util-1.9.2.jar")
//Permissions
@UsesPermissions(permissionNames = "")
public class EndTime extends AndroidNonvisibleComponent {
//Activity and Context
private Context context;
private Activity activity;
public EndTime(ComponentContainer container){
super(container.$form());
this.activity = container.$context();
this.context = container.$context();
}
@SimpleFunction(description = "Sample Function Generated by Niotron")
public string main(long unix){
//convert seconds to milliseconds
Date date = new Date(unix*1000L);
// format of the date
SimpleDateFormat jdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
jdf.setTimeZone(TimeZone.getTimeZone("GMT+6"));
String java_date = jdf.format(date);
return java_date;
}
}