B4J Code Snippet Set File Modified Date using JavaObject

B4X:
DateTime.DateFormat = "yyyy-MM-dd"
DateTime.TimeFormat = "hh:mm a"
Dim LastModifiedTime As Long = DateTime.DateTimeParse("2026-01-20", "10:05 pm")
Dim jo As JavaObject
jo.InitializeNewInstance("java.io.File", Array(File.Combine(File.DirApp, "dummy.txt")))
jo.RunMethod("setLastModified", Array(LastModifiedTime))

Edit: Sorry, just found this code snippet actually already existed
 
Last edited:

zed

Well-Known Member
Licensed User
There are a lot of code snippets.
It's hard to know if the one you're writing already exists
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…