I have the following code that splits dd/mm/yy :
var ukDatea = a.split('/');
return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
How can I change this so that I can use dd/mm/yy hh:MM and then get the hours and minutes into another array called ukTime? My problem is I am not sure how to split the remainder of the time?
There are several ways of doing that:
First split on the space, then split the date part on slash and the time part on colon.
Use a regular expression to extract all the parts.
Use the
DateTime.ParseExactmethod to parse the string into aDateTimevalue.