FL_GET_LAST_MODIFIED

Returns the last modified date of a FILE.

Syntax

Use one of the following:

FL_GET_LAST_MODIFIED( <stage_name>, <relative_path> )

FL_GET_LAST_MODIFIED( <file_url> )

FL_GET_LAST_MODIFIED( <metadata> )

Arguments

stage_name

The name of the stage where the file is located, as a string, in the form '@stage_name'.

relative_path

The path to the file on the stage specified by stage_name as a string.

file_url

A valid stage or scoped file URL as a string.

metadata

An OBJECT containing all the required FILE metadata. A FILE must have CONTENT_TYPE, SIZE, ETAG, and LAST_MODIFIED fields, plus the file’s location (that is, STAGE plus RELATIVE_PATH, STAGE_FILE_URL, or SCOPED_FILE_URL).

Returns

A TIMESTAMP value with the date the file was last modified.

Examples

Example using an input FILE:

CREATE TABLE file_table(f FILE);
INSERT INTO file_table SELECT TO_FILE(BUILD_STAGE_FILE_URL('@mystage', 'image.png'));

SELECT FL_GET_LAST_MODIFIED(f) FROM file_table;
Copy
+-------------------------------+
| FL_GET_LAST_MODIFIED(F)       |
|-------------------------------|
| Wed, 11 Dec 2024 20:24:00 GMT |
+-------------------------------+

Example using an input OBJECT:

CREATE TABLE file_table(f OBJECT);
INSERT INTO file_table SELECT OBJECT_CONSTRUCT('STAGE', 'MYSTAGE', 'RELATIVE_PATH', 'image.jpg', 'ETAG', '<ETAG value>',
    'LAST_MODIFIED', 'Wed, 11 Dec 2024 20:24:00 GMT', 'SIZE', 105859, 'CONTENT_TYPE', 'image/jpg');

SELECT FL_GET_LAST_MODIFIED(f) FROM file_table;
Copy
+-------------------------------+
| FL_GET_LAST_MODIFIED(F)       |
|-------------------------------|
| Wed, 11 Dec 2024 20:24:00 GMT |
+-------------------------------+
Language: English