Thursday, February 14, 2019

C# DATETİME.PARSE : CONVERT DATETİME TO STRİNG


C# DateTime.Parse : Convert DateTime to String

I have to create uniq field by use the date and account Id I entered in the data I created in 

web servi with code in c#. Example : 

Acount Id:12565

DateTime:02.02.2019 13.20

Uniq Field:02022019132012565  

Data field has to data time type. so I couldn't uniq field by use  02.02.2019  type

I tired datetime field  I create converting to string. I use substring method but   I had no 

idea how to eliminate the points . I found many source in the Internet.

I entered example date 02.02.2019. The code output  ".02.". This is output not the type I 

pushed.




Later, I find different method. The method I entered date time only year write on the screen. I entered

 date time only year write on the screen in the method


The output in the code:



As you can see onlly year output in the code. How much increase "y" is zero


I got what I wanted with codes. Above code The output in the code:




Something very simple but I spent my time a feq time. So, I hope you will help.

Good works...

No comments: