Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My question is in the title. I need every hour minute and second matched.
Posted
Comments
Sergey Alexandrovich Kryukov 2-May-15 21:47pm    
What have you tried so far?
—SA
[no name] 2-May-15 21:51pm    
If you are dealing with actual time pattern matching is not the way to do it. Why mention UTC?

1 solution

This is easy, but you should better do something very different. Use one of the System.DateTime.TryParseExact methods: https://msdn.microsoft.com/en-us/library/system.datetime.tryparseexact%28v=vs.110%29.aspx[^].

Specify the styles and exact format you need:
https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx[^].

After the parse is attempted, you will see by the function return if the input string matches the pattern or not.

—SA
 
Share this answer
 
v3

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