Solved

Getting Computers Date & Time

Posted on 2000-02-22
7
143 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 70

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

762 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