Solved

Getting Computers Date & Time

Posted on 2000-02-22
7
139 Views
Last Modified: 2010-05-02
Hi,
I was wondering if anyone could help me.
      I want to know how to get the current computer time and date,
in both 24 hr format or showing "AM/PM"


Thanks
Dave Steers
0
Comment
Question by:dsteers
7 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2548741
Use the Format function.

? format(time,"hh:nn:ss AMPM")
09:50:33 PM
? format(time,"hh:nn:ss")
21:50:47
0
 

Accepted Solution

by:
soosairaj earned 50 total points
ID: 2549037
Dear friend you can use  Now() function for both Date And Time .
 if you want only time you can use Time()
   if you want only  date you can use Date() function


Regards..

Raj
0
 
LVL 5

Expert Comment

by:KDivad
ID: 2549111
Date, Time and Now are probably what you want, but also take a look at the following functions: Year, Month, Day, Hour, Minute and Second.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:dsteers
ID: 2563701
Thank you everyone,soosairaj,emoreau &
KDavid.
0
 

Author Comment

by:dsteers
ID: 2563707
Also does anyone know a bit of code that would allow the subtraction of time over midnight.
E.g From 1300 (PM) Thursday 9 March to
 0200 (AM) Friday 10 March.

The Code will tell the difference between the two in days,hours & minutes.

Thanks
Dave Steers
0
 

Author Comment

by:dsteers
ID: 2563718
DAMM !!
I meant to Give the points to emoreau,
(sorry soosairaj).
My mistake.

emoreau I will post you the points in another question labled
"Points for emoreau"
sorry for this inconvienience.
Thanks
0
 
LVL 5

Expert Comment

by:KDivad
ID: 2564136
>>Also does anyone know a bit of code that would allow the subtraction of time over midnight.<<
Take a look at the DateDiff function.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now