Add to collection
Expert User

Expert User

Verified

Invoice Number | Order Number | Date | Current Date

Invoice Number | Order Number | Date | Current Date

Generate order number from current date and time in C#

NA
DateTime now = DateTime.Now;
string str = now.ToString();
string shams1 = str.Replace("/", "");
string shams2 = shams1.Replace("-", "");
string shams3 = shams2.Replace(":", "");
string shams4 = shams3.Replace(" ", "");
string shams5 = shams4.Replace("AM", "01");
string shams6 = shams5.Replace("PM", "02");
string shams = "PN" + shams6;
NA

Comments 0

  • Sorry!! No comment posted yet. Become the first user to give comment.
Add a comment

Would you like to write for w3 sniff?

Become part of an amazing group of contributors and authors and start writing for us

Join Now
NA
DateTime now = DateTime.Now;
string str = now.ToString();
string shams1 = str.Replace("/", "");
string shams2 = shams1.Replace("-", "");
string shams3 = shams2.Replace(":", "");
string shams4 = shams3.Replace(" ", "");
string shams5 = shams4.Replace("AM", "01");
string shams6 = shams5.Replace("PM", "02");
string shams = "PN" + shams6;
NA
Feedback submitted successfully.