I want to fill a cell with the current time, so it changes every time I open the file.
I currently use the NOW()
function for that, but it returns both the date and the time.
I want to see only the time. Is there a way to do that?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityAfter you entered the formual =now() to the cell, select the cell and press Ctrl + Shift + 2 You're welcome!
try this formula
=NOW()-TRUNC(NOW())
=NOW()-TODAY()
=TEXT(NOW(),"hh:mm")
- change "hh:mm" part as required - no formatting required (although the cell now contains text rather than a time - not crucial if this is for display)
Mar 25, 2012 at 20:38
co-erces
the value.....but it wouldn't work in a comparison with another time without using +0, e.g. =A1>TIME(23,59,59)
- where TEXT function is in A1 - that's always TRUE, need to use =A1+0>TIME(23,59,59)
to get correct results
Mar 25, 2012 at 20:55
=Now()
Cell
Format Cells
Custom
on left sideh:mm:ss AM/PM
OK
One more Solution:-
=TEXT(NOW(), "hh:mm:ss AM/PM")
You could try the following:
TIME(VALUE(LEFT(TEXT(NOW(), "HH:MM:SS"), 2)), VALUE(LEFT(RIGHT(TEXT(NOW(), "HH:MM:SS"), 5), 2)), VALUE(RIGHT(TEXT(NOW(), "SS:MM:SS"), 2)))
This will effectively break up the hours, minutes and seconds returned from the format function and format them as a time. I haven't tried it in the afternoon, so I'm not sure if you get problems with am/pm.
To just show the time you would hold --> CTRL + : <-- this will display the time only.
Use
=NOW()-TODAY(),
If you want to use it in a formula like "end time" - "current time" to find "total hours" then just format the "total hours" cell to number and multiply the whole formula by 24
like this
Current Time Finish Time Total Hours
=NOW()-TODAY() 8:30 PM =(B2-B1)*24
In time-related calculations you could use the following formula:
=MOD(NOW(); 1)
It returns the same value as @ChrisNeilsen's formula, but using less steps and getting the current date only once. The downside of this formula is the use of division.
In Google Sheets you could use the following hack instead:
(the TIMEVALUE()
function expects a string, but it works anyway)
=TIMEVALUE(NOW())
here is a link showing how to do this CLOCK WITH AUTOMATIC REFRESH
in line With Sheet1.Range("A1") replace Sheet1 with actual sheet name where you want this clock and A1 with cell where you want your clock
There's a built in function for this, to only provide the time. The function is =Time(). This keeps it from displaying the date, and will only display the current time of the OS upon the creation of a new entry.