473,394 Members | 1,739 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,394 software developers and data experts.

retrieving date& time from elapsed time string

Hi All,

This is a bit tricky to explain so please bear with me.

I am trying to get Window's "System" process starttime. The closest I have come to doing so is by using
Expand|Select|Wrap|Line Numbers
  1.  long st = procs.StartTime.ToFileTime();
  2. DateTime Dt = new DateTime(1601, 1, 1,0,0,0).AddSeconds(st);
  3. string stime = String.Empty;
  4. stime += (Environment.TickCount / 86400000).ToString() + ",";
  5. stime += (Environment.TickCount / 3600000 % 24) + ",";
  6. stime += (Environment.TickCount / 120000 % 60) + ",";
  7. stime += (Environment.TickCount / 1000 % 60);
which gives me (for e.g) 7,10,22,48

How can I convert the stime string into a datetime so that I can subtract it from DateTime.Now to get the process's starttime in the format dd/MM/yyyy HH:mm:ss?

This doesn't work btw
Expand|Select|Wrap|Line Numbers
  1. DateTime result = DateTime.Now - new TimeSpan (stime);
Mar 18 '12 #1
0 1210

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: fred14214 | last post by:
I need to be able to enter an elapsed time into a text field. This time then needs to be converted into seconds and stored in a field in some table. The user will enter a time (format is...
2
by: Terry Shandal | last post by:
Hi, I've been researching this for the past few hours but most of what i found involved work weeks/shifts. i hope my problem is simpler. Given a start date and a start time, end date and end...
4
by: Jim in Arizona | last post by:
I want to make buttons available or not available based on how much time has elapsed. An example: If NOW() 8 hours then btnOne.Visible = False Thanks. Jim
5
by: mmi48 | last post by:
Most of the discussions I've seen about elapsed time have, thus far, involved at least two date/time fields. I am trying to calculate time elapsed from one field across multiple records. The field...
5
by: alcool | last post by:
hi, I have 2 date/time values i.e. the system date/time and (h:m dd:mm:yyyy). I would like know to find a routine that calculate this difference. Maybe using the struct time_t and difftime. ...
3
by: Gretsch | last post by:
Web, html, javascript, Hi, I need to calculate the time since this .htm file was last modified. {which I can then use in a calculation, rather than display, so days&decimals format would be OK}...
7
by: wanwan | last post by:
Hi, I'm looking for a better way to do a date/time elapsed event rather than a timer elapsed event. Currently, I wrote my program to use a timer elapsed event set to 1 second, and it checks...
0
by: M.-A. Lemburg | last post by:
On 2008-05-08 14:31, Gabriel Genellina wrote: Using mxDateTime that's pretty easy (using number of days): 3050:18:01:25.91 or, if you'd rather like to see things broken down as relative...
3
by: teo | last post by:
I'm developing a software (a WinApp, not a WebApp) to retrieve Date & Time from a web server, but firstly I need to to test it on my PC, with "localhost" I'm using the VB Net language (below...
9
by: Ross | last post by:
I'm a newbie at this, and have searched a lot but can't find something that seems appropriate for measuring a recurring elapsed time. Creating an object with: var mydate = new Date(); seems...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.