asp.net - Which date and time will insert into SQL Server Database if I wrote in sql query as Getdate() for createDate field? -
if published asp.net solution on server , server date time correct.
now, when user access url lan network on pc , pc date time not correct.
in case if write insert tblcomp(1,'xyz','jam',getdate())
in query.then date time inserted.server or pc(which have accessing url)
tblcomp structure ******************** id int, sname varchar(50), sadd varchar(50), createdate datetime *********************
the query executes on database server, database server provide current date , time.
please note date , time in whatever time zone database server in well.
from the documentation of getdate()
:
returns current database system timestamp datetime value without database time zone offset. value derived operating system of computer on instance of sql server running.
if, on other hand, want local date , time of client, have provide through parameter. on asp.net site, not easy because "client code" asp.net application, running on web server, instead of date , time of database server use date , time of web server.
to client date , time (that is, local date , time of computer running web browser browsing site), have resort javascript, though i'm unfamiliar how that.
Comments
Post a Comment