Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

DateTime format

Hey

I'm using -

Code
FileInfo info = new FileInfo(Environment.CurrentDirectory + "/temp" + folder + "/" + filename);
            DateTime datetimelocal = info.LastAccessTime;
            string datetimedownloadtemp = dirlist[i].Substring(43, 12);
            DateTime datetimedownload = Convert.ToDateTime(datetimedownloadtemp);
            Console.WriteLine(datetimedownload);
            Console.WriteLine(datetimedownloadtemp);
            Console.WriteLine(datetimelocal);

along with some FTP shit in order to compare two datetime stanps. However, the FTP class returns the datetime in string format. When I try convert, it always gives 23:00:00 as the time. (or something similar)

Heres is the output -

[Image: 9fab702dde87c08618cc29526e78c980.png]

As you can see, its getting the date correct, but the time is all wrong.

Cheers
What can I do to sort this?
u get the LastAccessTime not the current
(Jun 23, 2015 05:06 AM)Only3 Wrote:  u get the LastAccessTime not the current

That's not the issue. I've tried with both. The issue is the timeStamp of the one. It's not correct because of the format.
try ParseExact. You probably have an issue with the culture.

https://msdn.microsoft.com/en-us/library....110).aspx


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by JoseCmanXDIINov 28, 2021 01:12 PM 6 203 Nov 28, 2021 01:12 PM
Last Post: OddEye
[Shell] by TimanxdDec 13, 2018 02:32 AM 7 292 Dec 13, 2018 02:32 AM
Last Post: Bobbyx28
[C#] by MeincraftJul 3, 2015 12:18 PM 1 54 Jul 3, 2015 12:18 PM
Last Post: +Haze