Java Question B4A long (Date) to java Date and vice versa

DonManfred

Expert
Licensed User
Hello,

for the Dropbox-SDK i need to read a date (java) from the datastore and get them in a b4a long (to use as date)
And i want to set a b4a long (datetime.now for example) into a datastore as java date.

i wrote the subs but i want to know whether this are correct or not.

B4X:
' b4a->java
        public DbxFields setDate(String name, Long value) {
            Date d = new Date(value * 1000);
            return getObject().set(name, d);
        }
' java->b4a
    public Long getDate(String name) {
       return getObject().getDate(name).getTime();
     }
 
Top