0

I am troubleshooting a time-card website using the following code early in the views:

@{
ViewBag.Title = "Clock In\\Out System";
var lvDate = System.DateTime.Now.ToShortDateString();
var lvTime = System.DateTime.Now.ToShortTimeString();
...
}

I think this is client time, I'm not sure how it is since Razor is supposed to be rendered at the server. Is this client time? Additionally, what is the simple and right way to collect client local time in a web page? I've been told there is a known compatibility issue with iOs and we need to support mobile, so I think I want to do this through javascript.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Empiricist
  • 116
  • 2
  • 8

1 Answers1

1

this is server side time.

if you want client time (from javascript), you will want to read this: How to get datetime in javascript?

if you want to get client time from within IOS (apple), you may want to use Swift as it has its native language and hooks into Javascript

but, if you are going to use javascript time, consider that unreliable as i can easily adjust my phone/pc time and clock in/out.

Community
  • 1
  • 1
2174714
  • 288
  • 2
  • 10