473,396 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Having Trouble with File TimeStamp Conversion

I'm transferring a file from server to workstation, using Web Service
Extensions and DIME. Along with the file, which travels as a DIME
attachment, I'm also sending along metadata information about the file as it
exists on the server. The metadata also travels as a DIME attachment in XML
format.

As you can see, the metadata contains several file timestamps. What I'm
trying to do is set the local file timestamps for Created, Modified and
Accessed to the same values as the file on the server. (The sample below
shows only the node for file creation; similar nodes are included in the XML
for last modified and last accessed.)

<fileinfo host="YOSSI" filespec="C:\SpeedControl.exe" size="1405672"
attributes="32">
<created display="6/16/2005 12:23:34 PM"
display_utc="6/16/2005 4:23:34 PM"
filetime="127634126149556455"
filetime_utc="127634270149556455"
/>
</fileinfo>

(In the following code statements FI is a FileInfo class.)

The filetime_utc attribute value is serialized into the XML as
FI.CreationTimeUtc.ToFileTime().ToString().

At the other end of the wire, on the local workstation, I attempt to
reconstitute this value as a DateTime value:

FI.CreationTimeUtc = Convert.ToDateTime(SFI.Created.FileTimeUTC)

However, I receive the following error: Invalid cast from Int64 to DateTime.

Any idea what I am doing wrong, and how can I do this properly?

Thanks very much for your help!

- Joe Geretz -
Nov 23 '05 #1
1 3812
OK, I got it. The function I need is:

FI.CreationTimeUtc = DateTime.FromFileTime(SFI.Created.FileTimeUTC);

It's working nicely. File is created on the workstation with the same
datetime stamps as the file on the server.

- Joe Geretz -

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uK*************@tk2msftngp13.phx.gbl...
I'm transferring a file from server to workstation, using Web Service
Extensions and DIME. Along with the file, which travels as a DIME
attachment, I'm also sending along metadata information about the file as
it exists on the server. The metadata also travels as a DIME attachment in
XML format.

As you can see, the metadata contains several file timestamps. What I'm
trying to do is set the local file timestamps for Created, Modified and
Accessed to the same values as the file on the server. (The sample below
shows only the node for file creation; similar nodes are included in the
XML for last modified and last accessed.)

<fileinfo host="YOSSI" filespec="C:\SpeedControl.exe" size="1405672"
attributes="32">
<created display="6/16/2005 12:23:34 PM"
display_utc="6/16/2005 4:23:34 PM"
filetime="127634126149556455"
filetime_utc="127634270149556455"
/>
</fileinfo>

(In the following code statements FI is a FileInfo class.)

The filetime_utc attribute value is serialized into the XML as
FI.CreationTimeUtc.ToFileTime().ToString().

At the other end of the wire, on the local workstation, I attempt to
reconstitute this value as a DateTime value:

FI.CreationTimeUtc = Convert.ToDateTime(SFI.Created.FileTimeUTC)

However, I receive the following error: Invalid cast from Int64 to
DateTime.

Any idea what I am doing wrong, and how can I do this properly?

Thanks very much for your help!

- Joe Geretz -

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Don Bruder | last post by:
Got a stumper here. I imagine that for someone experienced in C++, this is too pathetic for words. For a rookie, using this project as a sort of "midterm exam" in his self-taught "how to program in...
1
by: Dave | last post by:
I am working with an application that is returning a second based timestamp. It returns values based on the 86440 second day in GMT. Is there an ability within SQL Server to convert the value...
7
by: laclac01 | last post by:
So I am converting some matlab code to C++. I am stuck at one part of the code. The matlab code uses fread() to read in to a vector a file. It's a binary file. The vector is made up of floats,...
9
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script...
5
by: Jonathan Crawford | last post by:
Hi I am niew to pho and am having trouble with dates. I can format a date ok so $today=date('d M Y' ) gives me 2 Nov 2005 $dateval is a mysql date
0
by: James Foreman | last post by:
Looking at the documentation on EXPORT, when exporting a date column it will automatically use yyyymmdd. One could choose to use ISO format, but unfortunately the client I'm exporting to can't...
9
by: Adam Monsen | last post by:
I kindly request a code review. If this is not an appropriate place for my request, where might be? Specific questions are in the QUESTIONS section of the code. ...
0
by: Ulrich Wisser | last post by:
Hi, today I started to wonder about type conversion. I want to get all rows of a table dated between two given dates. Until now I use select * from mytable where to_date('20040115',...
5
by: laredotornado | last post by:
Hi, Using PHP 4.4.4 and I'm getting an odd time stamp attempting to make a php date. Here's the code $reqDate = date("Y-m-d", mktime(0, 0, 0, $y, $m, $d)); $reqDateTS = strtotime($reqDate);...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.