FTP: Server File Timestamp Shows Only Date Not Time

Mahares

Expert
Licensed User
Longtime User
The following statement in FTP to extract the date and time stamp does not include the time. How can I make it show both the date and time:
B4X:
DateTime.Date(Files(i).Timestamp)   'shows 10/05/2012
I tried:
B4X:
DateTime.Time(Files(i).Timestamp) 'this shows the time as: 00:00:00.
Thank you
 

Mahares

Expert
Licensed User
Longtime User
@Erel: I would like to convert the server file date to ticks or datetime.ticksperhour, but the conversion does not include the time. It converts to the ticks as of 0 hr am (midnight) of the file date:
The quesion is: How do you get the ticks equivalent of a file on the server with a date of say: 10/7/2012 and time of 7:30 AM
I am trying to use the below but I know I need the time in there too:

B4X:
dim ServerBaseDateTime as long
ServerBaseDateTime = DateTime.DateParse(DateTime.Date(Files(i).Timestamp))/DateTime.TicksPerHour
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
In order to get the TIME of the server file accounted for beside the file date, I used the following tedious code. It seems to yield the correct ticks. But if someone has a simpler way, I welcome it. Thanks:
B4X:
Dim ServerBaseDateTime as long
ServerBaseDateTime = (DateTime.DateParse(DateTime.Date(Files(i).Timestamp)) _ 
               + DateTime.TimeParse(DateTime.Time(Files(i).Timestamp)) _                         
-DateTime.DateParse(DateTime.Date(DateTime.Now)) )/DateTime.TicksPerHour
 
Upvote 0
Top