473,796 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting current time stamp

Hi,

I am having a problem with aquery. Firstly here is a script to create
the table and insert some sample data:

CREATE TABLE [dbo].[tbltemp999] (
[Machine_Name] [char] (17) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NOT
NULL ,
[EventDate] [datetime] NOT NULL ,
[EventID] [int] NOT NULL
) ON [PRIMARY]
GO

INSERT INTO tbltemp999 VALUES ('MOBL','2004-08-16 12:05:14.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-08-16 12:08:32.000',6 005)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-09-22 12:24:45.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-09-22 12:28:25.000',6 005)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-03 17:53:38.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-03 17:57:02.000',6 005)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-04 12:09:10.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-04 12:12:48.000',6 005)

The EventIDs 6005s represents a system start up and an EventID 6006
represents a system shut down/restart. I already have a query to
calculate the downtime of a particular date range. So when i want to
find the total uptime of a date range in the past i do the following:

Date1 00:00:00.000 to Date2 23:59:59.999 then subtract the downtime.

My problem arises when Date2 is todays date as the time of
23:59:59.999 would not have reached so the calculations are always
wrong.
How can I make the Date2 also read the current time?

If this is vague info feel free to ask me to explain better.

Thanks
Sunny
Jul 20 '05 #1
1 6762
"Sunny K" <su*******@yaho o.com> wrote in message
news:1e******** *************** ***@posting.goo gle.com...
Hi,

I am having a problem with aquery. Firstly here is a script to create
the table and insert some sample data:

CREATE TABLE [dbo].[tbltemp999] (
[Machine_Name] [char] (17) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NOT
NULL ,
[EventDate] [datetime] NOT NULL ,
[EventID] [int] NOT NULL
) ON [PRIMARY]
GO

INSERT INTO tbltemp999 VALUES ('MOBL','2004-08-16 12:05:14.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-08-16 12:08:32.000',6 005)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-09-22 12:24:45.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-09-22 12:28:25.000',6 005)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-03 17:53:38.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-03 17:57:02.000',6 005)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-04 12:09:10.000',6 006)
INSERT INTO tbltemp999 VALUES ('MOBL','2004-11-04 12:12:48.000',6 005)

The EventIDs 6005s represents a system start up and an EventID 6006
represents a system shut down/restart. I already have a query to
calculate the downtime of a particular date range. So when i want to
find the total uptime of a date range in the past i do the following:

Date1 00:00:00.000 to Date2 23:59:59.999 then subtract the downtime.

My problem arises when Date2 is todays date as the time of
23:59:59.999 would not have reached so the calculations are always
wrong.
How can I make the Date2 also read the current time?

If this is vague info feel free to ask me to explain better.

Thanks
Sunny


See my solution to your previous post. The last example involves
CURRENT_TIMESTA MP.

--
JAG
Jul 20 '05 #2

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

Similar topics

0
1238
by: Sean Cook | last post by:
I have the following case and need some help ... I need to select two groups of data based on the time stamp. Table 1 Card | Date | Time | #1 | #2 | #3 ----------------------------------------------------- 1 | 2004-09-09 | 19:39:21 | 841630 | 251534 | 110 2 | 2004-09-09 | 19:39:21 | 895424 | 256112 | 86 3 | 2004-09-09 | 19:39:21 | 895527 | 256881 | 109
7
19634
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance, Don Following running on client-side:
3
17614
by: phried1 | last post by:
I have created a form and inserted the following tables: Date Entered Time Entered Date Modified Time Modified Essentially how and where can I have these dates and times recorded so when the user creates a new record that date and time stamp is populating as well as if the user modifies the data, that date and time stamp is populationg. Whereby if the record was created yesterday, and the user modified the record today, i would see...
2
2584
by: Mark Poppers | last post by:
I would like to get the current time(stamp) (including the milliseconds) and assign it into a string variable with a format like: xxxx mytime = getcurrentsystemtime(); string mytime = reformatto("yyy.mm.dd HH:MM:SS:MSMS", mytime); How do I do this ? The hours should be displayed in 24h mode Mark
4
6810
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form allows the employee to enter their UserID and select "Login" or "Logout" and then click a submit. When the submit button is clicked, I want the application to dum the NT Userename, UserID, status (Login or Logout) and a date/time stamp into an MS Access...
6
9555
by: trytobreak | last post by:
Hi All, I am a network administrator in a fairly large software company and I would like to write myself a small utility, which would connect (one by one) to all machines on the network and get their current date and time stamps. This is mostly because of coming DST changes and having hundreds of machines on the network, I don't want to connect remotely to every and each server to see if the time is correct.
30
521
by: Ashit Vora | last post by:
Hi, I want to find the current time stamp in micro sec precision. The requirement is, my function is executed in an infinite loop. I measure a value and check if the value computed is what i expected 9forget all this stuff). I want to print the time stamp every time that event occurs. So my requirement is printing the current timestamps.
1
2838
by: Neel | last post by:
Hi, I want to find the current time stamp in micro sec precision. The requirement is, my function is executed in an infinite loop. I measure a value and check if the value computed is what i expected 9forget all this stuff). I want to print the time stamp every time that event occurs. So my requirement is printing the current timestamps.
29
4044
by: WannabePrgmr | last post by:
I am trying to display total numbers of data in a textbox, "Textbox200" on a form "Master", but I only want to display current daily data. I currently get the data from: Me.Text200 = DCount("", "") which gets the total "Live" data from the "LIVEquery", which is updated in the Form_Current. I would like to change this to look at the current date and only query for data entered during that date. I have a textboxx with the following in...
0
9525
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.