Hi there,
I need to use the following IF condition: If the document created date equals today, then move to the folder.
How can I make todays date as a string? What should I put here?

Hi there,
I need to use the following IF condition: If the document created date equals today, then move to the folder.
How can I make todays date as a string? What should I put here?

You can directly compare this with Now.
You should be able to get a comparison.
if you need 26-04-2024 00:00:00
you can use something like
Now.AddHours(-Now.Hour).AddMinutes(-Now.Minutes).AddSeconds(-Now.Seconds)
Please check the function names once before saving expression.
Thanks
Hi @NathaliaFawcett,
It depends on the date format of your “Created” variable.
Let’s say the date format is 4 digits year + 2 digits month + 2 digits day.
Example: 20240425
So, you have to convert the current date to the same date format to compare it properly.
In this case, you can use:
DateTime.Now.toString(yyyyMMdd)
Example 2:
25-04-2024
DateTime.Now.toString(dd-MM-yyyy)
Hope it helps!
Can you please share the date format in a document. I will help you with condition.
Regards
I am downloading things from a website and the created day should be like this

Hi @NathaliaFawcett,
DateTime.Now.toString(M/d/yyyy h:mm tt)
In this case, I understood that:
If this solves your problem and you agree, kindly mark the post that helped you the most as solution to close this topic.
If you need extra help or have any questions, please let me know ![]()
Thanks!
You can get the Date From the Folder Name
Directory.GetCreationTime(folderPath)
@NathaliaFawcett you can take your date format from config “yyyyMMdd”, you need to use below code which convert the string to date based of format.
if (Convert.ToDateTime(yourCreatedDateVariable).ToString("yyyyMMdd") == DateTime.Now.ToString("yyyyMMdd"))
{
//use move folder logic
Directory.Move(sourceDirName, destDirName)
}
Explanation:
yourCreatedDateVariable) to a DateTime object using Convert.ToDateTime.DateTime.Now to the desired format (yyyyMMdd) using ToString for proper comparison.Important:
"yyyyMMdd" with the actual format of your “Created” date variable if it’s different (e.g., dd-MM-yyyy for day, month, year).Finding the “Created” Date Format:
Additional Tips:
yyyyMMdd and dd-MM-yyyy and test your code.