• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

C# datetime

Hi,
I need to find   day.month year. For example: 14.12.2011. Can you please giva an example?
0
johnkainn
Asked:
johnkainn
  • 2
3 Solutions
 
p_davisCommented:
yourDateTimeMember.ToString("dd.MM.yyyy");
0
 
rajapandian_81Commented:
Hi,

Is this you want?

string strDateTime = DateTime.Now.ToString("dd.MM.yyyy");

Open in new window

0
 
rajapandian_81Commented:
or this one?

int iDay = DateTime.Now.Day;
int iMonth = DateTime.Now.Month;
int iYear = DateTime.Now.Year;

Open in new window

0
 
käµfm³d 👽Commented:
If you are saying you have a string and you want to convert it to a DateTime, then you can do:

IFormatProvider format = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat;
DateTime d = DateTime.ParseExact("14.12.2011", "dd.MM.yyyy", format);

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now