Click here to Skip to main content
15,896,493 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a system where in current date and time is to be extracted from server where database resides(and where application is published) .. I do not want to use system.datetime.now because it returns me client computer date time which is not reliable.. how can i extract date and time from server machine and use it in my .net application??? any help..
Posted

if your Database is in Server then write a query
in Oracle 'select sysdate from dual'
in sql use getdate()



in your appplication
system.datetime.now always returns the server time .....
 
Share this answer
 
Comments
Codes DeCodes 9-May-14 1:13am    
is it that getdate() is to be placed in stored procedure and application automatically returns in system.datetime.now or where to place getdate() in sql..
[no name] 9-May-14 1:16am    
declare a variable ( suppose @sysdatevar )
set @sysdatevar=getdate()
Codes DeCodes 9-May-14 1:21am    
as i am new in sql, i donot know much about it. can you tell where should i place getdate() function in sql??
sample SP :not using variable

CREATE PROCEDURE dbo.SPNameHere

AS
BEGIN
SELECT GETDATE() AS CurrentDateTime

END
 
Share this answer
 
Comments
Thanks7872 9-May-14 3:05am    
Dont repost solutions. Update the one you have posted before.
Codes DeCodes 11-May-14 0:45am    
thanks kan its working...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900