Tag Archives: File

Getting a file’s timestamp using ColdFusion

Finding a file’s date/time is now quite easy in ColdFusion by simply making use of the underlying Java File and Date objects. A bit of code … <cfset filePath = "datamyfile.txt"> <cfset fileObj = createObject("java","java.io.File").init(expandPath(filePath))> <cfset fileDate = createObject("java","java.util.Date").init(fileObj.lastModified())> At this point the fileDate variable contains a normal ColdFusion date. Couple of notes: The java.io.File [...]
Posted in ColdFusion | Also tagged | Comments closed