Partager via


File.SetLastModified(Int64) Method

Definition

Sets the last-modified time of the file or directory named by this abstract pathname.

[Android.Runtime.Register("setLastModified", "(J)Z", "GetSetLastModified_JHandler")]
public virtual bool SetLastModified (long time);
[<Android.Runtime.Register("setLastModified", "(J)Z", "GetSetLastModified_JHandler")>]
abstract member SetLastModified : int64 -> bool
override this.SetLastModified : int64 -> bool

Parameters

time
Int64

The new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)

Returns

true if and only if the operation succeeded; false otherwise

Attributes

Exceptions

Remarks

Sets the last-modified time of the file or directory named by this abstract pathname.

All platforms support file-modification times to the nearest second, but some provide more precision. The argument will be truncated to fit the supported precision. If the operation succeeds and no intervening operations on the file take place, then the next invocation of the {@link #lastModified} method will return the (possibly truncated) time argument that was passed to this method.

Added in 1.2.

Java documentation for java.io.File.setLastModified(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to