?
Solved

Datetime integer

Posted on 2009-12-27
6
Medium Priority
?
207 Views
Last Modified: 2012-05-08
I've got the following xml ( from third party)

<performance_start>1217617200</performance_start>
<performance_end>1217620800</performance_end>

I need to extract these dates. Though i dont know how to interrupt this format. How do you turn this int value into a datetime
0
Comment
Question by:frosty1
6 Comments
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 total points
ID: 26127189
it looks like the number of ticks that represent the start/end of the opertation:
        Dim ts As TimeSpan
        ts = TimeSpan.FromTicks(1217617200)

0
 
LVL 9

Expert Comment

by:magicdlf
ID: 26127192
Try this.
            DateTime time = new DateTime((long)1217617200);
0
 
LVL 9

Expert Comment

by:magicdlf
ID: 26127198
To calc the time span, you can also do this.
            DateTime start = new DateTime(1217617200);
            DateTime end = new DateTime(1217620800);
            TimeSpan ts = end - start;
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 26127210
to calculate the elapsed time, just use this:

     Dim elapseTime As TimeSpan

        elapseTime = TimeSpan.FromTicks(1217620800 - 1217617200)
        Console.WriteLine("elapseTime: {0}", elapseTime.ToString())
0
 
LVL 11

Expert Comment

by:lenordiste
ID: 26127850
both solutions from MagicDf and sedgwick will give you the same answer.

However I would personnaly try to get information about that 3rd party program before doing anything with those dates. Simple because unless you know for sure what those integers are they could be just about anything: worst case scenario is thatt XML is a response from a webservice coded in another language which may be spitting out the database representation of a date.
0
 

Author Comment

by:frosty1
ID: 26127863
thanks guys, really good feedback. Seems like the third party left out the actual day. ie just gave the timespam. Really appreciate the response. Clarify things for me.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question