Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
posywang
Creator II
Creator II

How to compare file time with today's date

Hi, can anyone show me how to compare file time of a source file with today's date? I am trying to write script to stop the app running if file time is earlier than today's date. Thank you.

3 Replies
YoussefBelloum
Champion
Champion

Hi,


for the file time you have this:


FileTime() => it return a timestamp, so yo should do this: Date(Filetime()) 


IT IS A SCRIPT FUNCTION


and for today date, you have this:


Today()


so you can compare like this:

if(filetime(file.extention) <..>..<=..>=.. today(), ..., ...) as ...



bnichol
Specialist
Specialist

exit script when filetime( 'your file location' ) <  today()

vishsaggi
Champion III
Champion III

Try this and change your script accordingly.

Change the file paths and filenames accordingly.

SET vFilePath = 'P:\SetAnalysis_Udemy\';

LET vFileTime = Date(FileTime('$(vFilePath)Bubble.qvw'));

IF $(vFileTime) >= Date(Today()) Then

Load * INLINE [

Name, ID

A, 2

B, 3

C, 4

];

ELSE

Exit SCRIPT;

ENDIF;