|
-
Sep 21st, 2007, 04:59 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] select server date
somebody has shown like this to capture the server date
is it ok to have server date like this
rsdate as adodb.recordset
Set rsdate = conn.Execute("select getdate()")
Last edited by yousufkhan; Sep 21st, 2007 at 06:27 AM.
-
Sep 21st, 2007, 05:41 AM
#2
Re: select server date
I'm not slzamany, but I'll answer anyway.
Kaffenils: "Yes."
-
Sep 21st, 2007, 08:20 AM
#3
Re: select server date
To expand on that a little, it is fine for SQL Server.
Based on another thread of yours, I think it is important to remind you that it will not work for Access - and there is nothing in terms of SQL that will do it (you need to use VB code to find the date/time of another machine, and you can probably find it in our CodeBank forums).
-
Sep 21st, 2007, 09:39 AM
#4
Re: select server date
I'm not kaffenils
But I would do:
Code:
rsdate as adodb.recordset
Set rsdate = conn.Execute("select Convert(varchar(23),getdate(),121)")
to get it in a consistent format - that full GETDATE() datetime with milliseconds...
Did you want it with time??
Otherwise you do:
Code:
rsdate as adodb.recordset
Set rsdate = conn.Execute("select Convert(varchar(10),getdate(),101)")
That returns MM/DD/YYYY
...but from what Si said - is this ACCESS???
-
Sep 22nd, 2007, 01:26 AM
#5
Thread Starter
Hyperactive Member
Re: select server date
szlamany
actualy when i posted this thread i had specified your name in that to answer thats y kaffenils has written like that i am not szlamany but is ll answer so you pls dont mind it
now the problems is that i m helpless with access database bcoz one of my application is running since a long and i am not in the position to change that database to sql and problem i m facing is that if client machines date gets change due to any reason than transaction are taking wrong date thats y
i wanted to use server date while inserting or updating the records in access mdb even if is use default date it ll insert the local machine date but if i select the server date capture as us said
rsdate as adodb.recordset
Set rsdate = conn.Execute("select Convert(varchar(10),getdate(),101)")
than i ll get the correct running date bcoz the access mdb is also on the same serve where the sql is
friends now tell me what is your advise
-
Sep 22nd, 2007, 04:36 AM
#6
Re: select server date
 Originally Posted by szlamany
But I would do:
Code:
rsdate as adodb.recordset
Set rsdate = conn.Execute("select Convert(varchar(23),getdate(),121)")
to get it in a consistent format
I always do let the client take care of the formatting.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|