0

我正在获取这样的 ftp 文件的时间戳值:

ftpRequest.Method = System.Net.WebRequestMethods.Ftp.GetDateTimestamp

通过:

ftpResponse.StatusDescription

它返回:

213 20120512102159

我很确定 213 是 ftp 状态代码,然后 20120512102159 将是 2012、05(may)、12(12th),然后可能是 HH MM SS ...但这与我的本地系统不匹配,所以可能FTP服务器的本地时间?

无论如何......这个值是一个字符串,我错过了一些明显的日期值吗?否则,如何将此字符串作为日期时间值?

4

1 回答 1

1

尝试这样的事情来解析字符串:

Dim dateValue as DateTime
dateValue = DateTime.ParseExact(ftpResponse.StatusDescription.substring(4, "yyyyMMddHHmmss", 
                                            CultureInfo.InvariantCulture, 
                                            DateTimeStyles.None);
于 2012-05-12T11:14:12.740 回答