Click here to Skip to main content
15,885,932 members
Home / Discussions / C#
   

C#

 
GeneralRe: MakeGenericType/CreateInstance Object to underlying Type at run-time: why this works is driving me crazy Pin
OriginalGriff28-Sep-21 10:40
mveOriginalGriff28-Sep-21 10:40 
GeneralRe: MakeGenericType/CreateInstance Object to underlying Type at run-time: why this works is driving me crazy Pin
BillWoodruff29-Sep-21 0:57
professionalBillWoodruff29-Sep-21 0:57 
Questionled matrix display Pin
Member 1537173026-Sep-21 7:49
Member 1537173026-Sep-21 7:49 
AnswerRe: led matrix display Pin
OriginalGriff26-Sep-21 8:33
mveOriginalGriff26-Sep-21 8:33 
QuestionC# 8 nullable reference question / conundrum Pin
Super Lloyd25-Sep-21 1:36
Super Lloyd25-Sep-21 1:36 
QuestionConvering time representation format Pin
Alex Dunlop21-Sep-21 23:26
Alex Dunlop21-Sep-21 23:26 
AnswerRe: Convering time representation format Pin
Peter_in_278022-Sep-21 1:28
professionalPeter_in_278022-Sep-21 1:28 
AnswerRe: Convering time representation format PinPopular
Richard Deeming22-Sep-21 1:37
mveRichard Deeming22-Sep-21 1:37 
That's a lot of code for something the framework already does for you. Smile | :)
C#
public static string TimeConverter(string time)
{
    if (!DateTime.TryParseExact(time, "h:mmtt", CultureInfo.InvariantCulture, DateTimeStyles.None, out var value))
    {
        return string.Empty;
    }
    
    return value.ToString("HH:mm:ss", CultureInfo.InvariantCulture);
}
DateTime.TryParseExact Method (System) | Microsoft Docs[^]
Custom date and time format strings | Microsoft Docs[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

AnswerRe: Convering time representation format Pin
BillWoodruff22-Sep-21 22:00
professionalBillWoodruff22-Sep-21 22:00 
AnswerRe: Convering time representation format Pin
Pete O'Hanlon23-Sep-21 2:03
mvePete O'Hanlon23-Sep-21 2:03 
GeneralRe: Convering time representation format Pin
Alex Dunlop23-Sep-21 9:22
Alex Dunlop23-Sep-21 9:22 
QuestionRe: Convering time representation format Pin
Member 1532961323-Sep-21 9:32
Member 1532961323-Sep-21 9:32 
GeneralRe: Convering time representation format Pin
Mycroft Holmes23-Sep-21 12:50
professionalMycroft Holmes23-Sep-21 12:50 
GeneralRe: Convering time representation format Pin
Pete O'Hanlon23-Sep-21 20:29
mvePete O'Hanlon23-Sep-21 20:29 
GeneralRe: Convering time representation format Pin
Peter_in_278023-Sep-21 21:03
professionalPeter_in_278023-Sep-21 21:03 
QuestionHow to convert Persian date representation? Pin
Alex Dunlop15-Sep-21 20:31
Alex Dunlop15-Sep-21 20:31 
AnswerRe: How to convert Persian date representation? Pin
BillWoodruff15-Sep-21 21:31
professionalBillWoodruff15-Sep-21 21:31 
GeneralRe: How to convert Persian date representation? Pin
Alex Dunlop15-Sep-21 22:05
Alex Dunlop15-Sep-21 22:05 
GeneralRe: How to convert Persian date representation? Pin
BillWoodruff15-Sep-21 22:22
professionalBillWoodruff15-Sep-21 22:22 
GeneralRe: How to convert Persian date representation? Pin
Alex Dunlop16-Sep-21 1:11
Alex Dunlop16-Sep-21 1:11 
GeneralRe: How to convert Persian date representation? Pin
Richard Deeming16-Sep-21 1:26
mveRichard Deeming16-Sep-21 1:26 
GeneralRe: How to convert Persian date representation? Pin
BillWoodruff16-Sep-21 4:23
professionalBillWoodruff16-Sep-21 4:23 
GeneralRe: How to convert Persian date representation? Pin
Richard Deeming16-Sep-21 4:53
mveRichard Deeming16-Sep-21 4:53 
GeneralRe: How to convert Persian date representation? Pin
BillWoodruff16-Sep-21 5:01
professionalBillWoodruff16-Sep-21 5:01 
GeneralRe: How to convert Persian date representation? Pin
BillWoodruff21-Sep-21 8:52
professionalBillWoodruff21-Sep-21 8:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.