Adding Date & time into CSV File Name

Hi,

I have the following code in an Epicor Function which is currently exporting a csv file called Orders.csv.
What i need to happen is name the export Orders_320270918051.csv

I have tried the below but i am recieving errors when running the function as a schedule.

Errors i receive below.Any help here would be appreciated.

.ToString("MMddyyyyHHmmss")

That format makes it look like I’m typing while having a stroke, lol.

If it yells, you may have to do

Convert.ToDateTime(BpmFunc.Now()).ToString("MMddyyyyHHmmss")
3 Likes
    if (File.Exists(fullFilePath))
    {
        // Generate a unique file name using a GUID
        string uniqueFileName = Guid.NewGuid().ToString() + "_" + this.callContextClient.CurrentUserId + "_" + FileName;
        string newFilePath = Path.Combine(filePath, uniqueFileName);
    
        // Rename the new file
        File.Move(fullFilePath, newFilePath);
        fullFilePath = newFilePath;
    }

I added a Guid on the end :wink: