Save file with todays date

Hello!

I want to write a file and save it as “upload july 19th Part 1”. “upload” and “Part 1” is fixed… But how can i get the date in a form like this? The date changes every week

1 Like

Yah @Loons
We can do like this in general
“Yourfilename”+”_”+now.tostring(“dd_MMM_yy”)+”.yourfileextension”

To be exact in what you need
“Yourfilename”+”_”+Now.String(“MMM dd”)+”th”+”_Part1”+”.yourfileextension”

Simple isn’t it @Loons
Cheers

1 Like

Use this to get the current date in that particular format:

DateTime.Now.ToString("yyyy/MM/dd")

“upload “+date.now.tostring(“MMM dd”)+” th Part1.xyz”

xyz is your file extension…

1 Like

@Palaniyappan @sagaryeole

But when I have for example “july 1st” then “th” isn’t correct.

1 Like

@Loons
Try this…
"upload "+now.ToString(“MMMM dd”)+“th “+“Part 1”+”.FileExtension”

Fine
in that case this would work, sounds the same but of different format

Cheers @Loons

1 Like

Hi @Loons,

Try this:
“Upload “+Now.ToString(“MMM dd”)+“th”+” Part 1”

please check the following attachment
make changes as per ur need

Main.xaml (8.7 KB)

Hey @sagaryeole, this looks brilliant. What does the cdate function do? Can see the overall logic (choosing ‘st’, ‘rd’ ‘th’ depending on date) but haven’t seen this function before.

Thanks
Jordan

CDate is use to convert string to Date format.

1 Like

Hey,
But this would give filename as “11st, 12nd, 13rd Aug” but not “11th, 12th, 13th Aug…”

welcome !!
Thanks for correcting…

Main.xaml (13.7 KB)

Please find the updated one

Hello @Loons I know it is already solved but simple solution to your problem is below…
Main.xaml (6.8 KB)

Ref: Easy Function to add a suffix to a number ie, 1st, 2nd, 3rd, etc..-VBForums

1 Like

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