Reputation: 2598
I'm getting the timestamp value of an ftp file like this:
ftpRequest.Method = System.Net.WebRequestMethods.Ftp.GetDateTimestamp
Through:
ftpResponse.StatusDescription
It returns:
213 20120512102159
I'm pretty sure 213 is the ftp status code, and then 20120512102159 would be 2012, 05(may), 12(12th), then probably HH MM SS... But this doesn't match my local system, so possibly the FTP server's local time?
Anyhow... This value is a string, am I missing some obvious value of just the date? Otherwise, how do I get this string as a datetime value?
Upvotes: 0
Views: 1591
Reputation: 3363
try something like this to parse the string out:
Dim dateValue as DateTime
dateValue = DateTime.ParseExact(ftpResponse.StatusDescription.substring(4, "yyyyMMddHHmmss",
CultureInfo.InvariantCulture,
DateTimeStyles.None);
Upvotes: 1