Add Minutes

Hi Team,

I want to pick only those files that are placed 1 hour back.
File Name is Test_10112022_080000.xls
Here the file contains file time as 8 which means file placed at 8pm/am
Assume current system time is 9pm/am i want only those files that are placed between 8 to 9.
I extracted 080000 and placed in variable FileTime
so FileTime<=Now.AddMinutes(-60).ToString(“hhmmss”)
Not getting me the correct result.
Some one share a sample file

HI @Robotics

How about this expression

Filename = "Test_10112022_080000.xls"

Filename>= "Test_10112022_"+Now.AddMinutes(-60).ToString("hhmmss")



Hi @Robotics

You need to compare the other way round. First extract date as well and use datediff(dateinterval.Minute,datetime.parseexact(“ 10112022_080000”,”ddMMyyyy_hhmmss”,system.globalization.culturalinfo.invariantculture,now.addminutes(-60)) this will give difference in minutes you can check greater than 0 less than 60 anything


Use “HHmmss” which formats time in 24hr format


1 Like

Hi @Robotics ,

Considering that the file is being created or placed from a Source folder to a New/Destination folder. We could also try using the CreatedDate by using the FileInfo class like below :

DateDiff(DateInterval.Minute,CDate((new FileInfo(FileName)).CreatedDate),Now)<=60

Debug :

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.