EzDevInfo.com

date-time interview questions

Top date-time frequently asked interview questions

Force date/time/clock sync

My Snow Leopard macbook is set to Set date and time automatically: Apple Americas/U.S. (time.apple.com), but despite sitting idle for several hours (with internet connection), it has yet to do any syncing, the date remains off by ~2 days.


Source: (StackOverflow)

Linux runasdate analogue

I want some user (or some process) to have different time and date. Is it possible?

How can I do this?


Source: (StackOverflow)

Advertisements

Windows 8 date format dd/mm/yyyy

Is it possible to change the date format for Windows 8 to be dd/mm/yyyy with the separator being specifically (/)?

Is the only way to do it in the registry?

Start program regedit.exe (via Win + R and type regedit). Go to HKEY_CURRENT_USER\Control Panel\International. Find ShortDate item and change the value to DD/MM/yyyy. Then you need to restart the computer, and it will start to work.


Source: (StackOverflow)

How to calculate hours and minutes between two time periods?

I’m working on a very simple time sheet for my work in Excel 2007, but I have run into trouble about calculate the hours and minutes between two time periods.

I have a field: timestart which could be for example: 08:30

Then I have a field timestop which could be for example: 12:30

I can easy calculate the result myself which is 4 hours but how do I create a “total” table all the way down the cell that calculates the hours spend on each entry?

I’ve tried to play around with the time settings but it just give me wrong numbers each time.


Source: (StackOverflow)

How to change Windows 10 Lock screen time format?

My Windows 10's time format is 24 hour clock, this includes the taskbar but the lock screen is still 12 hour clock format. How do I change the format of my time in lockscreen?


Source: (StackOverflow)

Internet Time tab has disappeared from the Date and Time applet of the Control Panel

Previously, there was an Internet Time tab on the Date and Time applet of the Control Panel, wherein one could force a query of an internet time server and also type in a different server from the ones supplied. However, this tab has now disappeared, and I need to have it back. I should mention that this machine has never been part of a domain, since it seems that machines that are such do not have such a tab. I should be obliged to anyone who can help me restore the missing tab.

Windows 7 Home Premium Service Pack 1


Source: (StackOverflow)

Leap Seconds in Windows

A leap second was recently added on June 30, 2015 23:59:60 UTC.

How are leap seconds implemented in Windows (specifically Windows 7)?


Source: (StackOverflow)

Windows 7 time keeps changing by itself

As the title suggests windows time keeps changing in random times, with random amounts. It sometimes happens every minute, sometimes it is good for hours. If I go hit synchronize with Internet time, it updates to the correct time.

Things I read/checked

  1. Disable/Enable Internet time synchronization. No help.
  2. Disable/Enable windows time service. No help.
  3. CMOS battery is dead. No it is not dead. Time changes also do happen when windows is running.
  4. Your router/modem time is wrong and effecting windows time. No, it is not wrong.
  5. Your time zone is configured incorrectly. No it is UTC+0 London
  6. You are dual booting into Hackintosh/Linux. No only Win 7 runs on this PC.
  7. You have a dodgy overclocking. I did have a high OC profile, but tried running at stock speeds with no help.
  8. Virus/Trojan. I highly doubt it. This is a very bare Windows installation for gaming. Only windows and games with Steam are installed.

Update

I can confirm, this problem does not exist, when I start the windows in Safe Mode. I've tested this by booting into safe mode. After the boot, I corrected time manually and left the pc running for a couple of hours, and the time was not changed.

Update 2

I don't know how I missed this detail (or actually if it will help) but the time resets to "that" exact time. That exact time being the first updated time.

Example:

  • I boot the PC, and after sometime it resets to (lets say) 09:33:27
  • a-) I correct the time, leave it for a period, and it jumps back to 09:33:27
  • b-) I leave it running for some time and it resets to 09:33:27 after a period (very random period I see no pattern here like hourly/every 17 minutes or anything else)
  • This keeps happening, regardless of me changing the time or not.
  • After next boot (next day?) it picks another time to reset to

More details

Here is a screenshot from Event viewer, about the time change. Keep in mind this screenshot is taken when the "Windows Time" service is disabled.

enter image description here

Event properties screenshot:

enter image description here

Details page from same event:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
  <Provider Name="Microsoft-Windows-Kernel-General" Guid="{A68CA8B7-004F-D7B6-A698-07E2DE0F1F5D}" /> 
  <EventID>1</EventID> 
  <Version>0</Version> 
  <Level>4</Level> 
  <Task>0</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8000000000000010</Keywords> 
  <TimeCreated SystemTime="2014-01-25T09:38:34.500000000Z" /> 
  <EventRecordID>19280</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="4" ThreadID="64" /> 
  <Channel>System</Channel> 
  <Computer>slayer</Computer> 
  <Security UserID="S-1-5-18" /> 
</System>
<EventData>
  <Data Name="NewTime">2014-01-25T09:38:34.500000000Z</Data> 
  <Data Name="OldTime">2014-01-25T13:59:57.982183900Z</Data> 
</EventData>
</Event>

Screenshot and the details kind of implies that, windows is really thinking that this is the correct time and feel the need to update it. Although no windows service is activated to authorize this.

Any ideas?

Update 3 Problem & Solution

The problem was apparently not Windows or any other software trying to update the time.

After reading the system memory dump for an hour I found out Windows was unable to read RTC from motherboard. After failing to read the RTC state for a while, Windows thinks it is calculating the time wrong and reverts to last know RTC state.

I have no idea why this is not happening in "Safe Mode" and running windows successfully under safe mode put me in completely wrong route (Searching for an error in Software instead of hardware) The source of the fault was System BIOS (or UEFI in my case) not running at all after System POST's and boots. A simple google search for this and apparently it is a really common problem with most UEFI boards(Using an Asus-ROG board myself)

Solution advised was: Flash your UEFI and reset CMOS on standby power. Since I knew I was already on a recent version UEFI, just resetting CMOS on standby worked for me. Everything works now without a problem.

Thanks for all the input and sorry for misleading info about the problem, but I'll leave all the information posted above, hoping that it might else someone else.


Source: (StackOverflow)

Automatically change time based on current location

I often move between 2 time zones, and expect my Windows 7 laptop to somehow automatically change the system time, being spoiled by the same feature on my cell phone. I always assumed that desktop O/Ses simply did not do this, but I was shocked yesterday when I noticed that OSX on the MacBook actually does this!

Does anybody know of any utilities that does this on Windows, specifically Windows 7? There has to be something out there?


Source: (StackOverflow)

Clock running fast after OS X Mavericks install

I've noticed my OS X system time on my iMac is running faster after I updated to Mavericks, after about a week it is a good 4 or 5 minutes too fast.

In my Date & Time preferences everything is set to automatic, time is set to update using Apple Europe (time.euro.apple.com.) and the time zone is set to automatic too.

Any idea why this could be happening, and how to fix it?


Source: (StackOverflow)

Converting Unix Time into Human Readable Format in Excel

I have a spreadsheet containing several timestamp columns, given in Unix time, i.e. number of seconds since 01/01/1970 00:00.00 UTC.

Using Excel 2010, are there any methods, and if so how, to convert these timestamps into a date/time format recognizable by Excel?


Source: (StackOverflow)

How do I calculate number of hours > 24 in Excel?

I've got an excerpt of my spreadsheet below. It's a time tracking application containing a start date/day, a session ID and the duration of the session. Column A is populated by adding the duration in Column D. I'm trying to total the durations, but keep getting incorrect values in cases where the total duration is > 24 hours.

Consider

     A                   B        C                D         
1  2012/05/22 01:00  |  Wed  |  Session 23341  |  9:00
2  2012/05/23 10:00  |  Wed  |  Session 23342  | 22:00
3  2012/05/25 08:00  |  Fri  |                 |  0:00

As you can see, the date differential between A2 and A3 demonstrates that the value of 22:00 in D2 represents a duration of 46 hours (05/23 10:00 + 46:00 = 05/25 08:00). However, Column D is only displaying the 22:00 in excess of a full 24 hour day.

My attempts to read D2 have included int(d2) = 0.00 / int(d2)*24 = 0.00 / hour(d2) = 22.00 / int(a3-a2)*24 =0.00 etc. and have been unsuccessful in pulling a value of "46".

How can I accurately represent D2 to achieve accurate summary data?


Source: (StackOverflow)

How to prevent Excel to use the OS regional settings for date patterns in formulas

According to this question I have the following problem:

I want to use some Excel function (not the cell formatting) like TEXT(A1, {date_pattern})

But the person who answer my previous question make me found that the date pattern change according to the Windows Regional Settings.

However, my OS (Windows 7) is in English and the Office suite as well. By looking in my Regional settings it show even a pattern using English notation (dd.MM.yyyy)

Region and Language

I want to know if there is any way to disable such behaviour from Excel, meaning I want to always use the English patterns and never the localized ones because I do not want the behaviour of my Excel sheet to change according to localisation of the reader.

A simple case would be reformatting some date field to a computer centric way like this: "yyyymmdd_hhss" this is recognized universally and can be sorted up and down easily. But as I am in the French part of Switzerland part I should write "aaaammjj_hhss" and if I send this Excel to a colleague in Zürich he would not be able to see the proper date as he got the Swiss German localization (his excel would expect "jjjjmmtt_hhss")

We were clever enough to install all windows and office in English but we still face problem like this because this link to the OS regional settings.

For me the changing Windows Settings is not an option because all the other programs are using this settings.


Source: (StackOverflow)

How to stop Excel Treating US dates as UK dates?

I'm in the UK, I've got a problem where I've got a list of dates supplied in US format. Excel seems to treat the ones that are valid in both formats as UK dates, (e.g. 03/01/2012 becomes 3rd of January rather that 1st March), and treat the ones that aren't valid UK dates (e.g. 03/13/2012) as basic text. I assume this choice is something to do with my regional settings.

What I want is the system to recognise that this column of text is supplied in US date format, and convert it into the underlying date representation for calculations.

How do I do this?

EDIT: The dates are supplied in a CSV file of the form:

3/ 1/2012, 09:01     , 18:58     ,9.4,0.6

where 3/1 is 1st of March


Source: (StackOverflow)

Why is my NTP controlled computer clock two minutes ahead?

The clock in my computer is configured to be synchronized using NTP. To verify this I have tried two NTP clients using various NTP servers. My computer and the NTP clients are in complete agreement about the current time even across a wide range of NTP servers.

I also have a GPS and my national phone company provides an accurate clock available by calling a specific phone number. Both my GPS and the phone company agrees on the current time. However, my computer is almost precisely two minutes (or 1 minute and 59 seconds) ahead of what I believe to be the "real" current time where I live.

Why is my computer two minutes ahead? I realize that synchronizing clocks using the internet may not be entirely accurate as there is latency, but two minutes is a very long time on the internet. Is NTP really two minutes ahead? I'm running Windows 7 and live in the time zone UTC+1, but I don't think that is important in understanding my problem.


Source: (StackOverflow)