0

recently I needed to update the copyright year on a website, so I used java script to get the year from the system time but is there a way to use an internet time server to update the copyright year ?

I think it has very less chances of ever being wrong as opposed to system time or a windows server time.

David Kent
  • 15
  • 8
  • Use the Unix time – Andreas Jan 06 '20 at 04:56
  • Why not just update the code? – Brad Jan 06 '20 at 04:59
  • Ideally you would want to serve the webpage from your server already with the correct year. – Derek 朕會功夫 Jan 06 '20 at 05:02
  • @Brad Do you mean Update the year ever year in the code ?? Well is that not a waste of time ? – David Kent Jan 06 '20 at 05:19
  • @DavidKent Sounds like far less a waste of time than what you're proposing. Plus, what you're proposing is going to require connecting to yet-another-server client-side. It should take you almost no time to replace the year where needed. If you want to get creative, output it in your ASP.NET code. Or, make a template. Something. – Brad Jan 06 '20 at 05:23

2 Answers2

0

You can either use a 3rd party service via API, scrape a reliable source or use your own server with an API endpoint (what language are you using on your server?)

This is an example of a time server api

http://worldclockapi.com/api/json/est/now

andromeda
  • 4,433
  • 5
  • 32
  • 42
0

Using system time to update is not he correct way. If you have dual boot, and if you switch from windows to ubuntu, and back to windows, it displays wrong time.

Use some free api providers to fetch the time:

Free Rest API to retrieve current datetime as string (timezone irrelevant)

Write one more api to fetch the system time.

HarshaHR
  • 73
  • 4