Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
there is label in which date time is showing from databse(Ms SQL) (5/23/2020 8:00:00 AM) like this. I would like to display
only Time like 8:00:00 AM like this. I would like to trim date part please help . I am using c# as programming language.

What I have tried:

there is label in which date time is showing from databse(Ms SQL) (5/23/2020 8:00:00 AM) like this. I would like to display
only Time like 8:00:00 AM like this. I would like to trim date part please help . I am using c# as programming language.
Posted
Updated 23-May-20 13:13pm
v2
Comments
Garth J Lancaster 23-May-20 9:30am    
so far you've asked 2 prior questions, and your work has been done for you /// why don't you try yourself, and post some actual code - you might wish to start by reading https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings and https://docs.microsoft.com/en-us/dotnet/api/system.datetime.parseexact?view=netcore-3.1
Richard MacCutchan 23-May-20 10:01am    
That's a solution surely.
Richard MacCutchan 23-May-20 10:03am    
In addition to Garth's comment you really need to study the C# language and basic .NET classes in greater detail. Your questions suggest that you are doing a number of things wrong, and storing up a lot of trouble for the future.

DateTime.TimeOfDay Property (System) | Microsoft Docs[^]
You can take any DateTime value and get the time of day it represents as a TimeSpan.
 
Share this answer
 
Comments
Maciej Los 24-May-20 3:06am    
5ed!
so far you've asked 2 prior questions, and your work has been done for you ... why don't you try yourself, and post some actual code

- you might wish to start by reading Custom date and time format strings | Microsoft Docs[^] and DateTime.ParseExact Method (System) | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
Maciej Los 24-May-20 3:06am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900