C# to determine AM or PM
string strDate = DateTime.Now.ToString("tt");
The above function will return either AM or PM based on current time.
Then you can build your own logic to interpret the above string
if (strDate.Equals("AM"))
strGreeting = "Morning";
else
strGreeting = "Afternoon";
Happy Coding
No comments:
Post a Comment