question

Voytec avatar image
0 Votes"
Voytec asked RoyLi-MSFT commented

UWP C# converting DateTime.Now ToString error.

How can I use DateTime.Now.xXx to fit into a string Date?:
string Date = Date.Time.Now.Day.ToString + DateTime.Now.Month.ToString + DateTime.NowYear.ToString;
I want it to work like this...

windows-uwp
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This is tagged as UWP but appears to be a C# question, not a UWP question.

0 Votes 0 ·

@Voytec-6484 Could you please take a look at SimpleSamples's answer. It should be able to solve your issue.

0 Votes 0 ·

1 Answer

SimpleSamples avatar image
1 Vote"
SimpleSamples answered RoyLi-MSFT commented
 string Date = DateTime.Now.ToString("ddMMyyy");

Produces:

 26082021
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I didn't know it is needed to use "()".
thanks @SimpleSamples

0 Votes 0 ·

@Voytec-6484 You could consider accepting @SimpleSamples 's reply as answer if his reply solves your issue.

0 Votes 0 ·