Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Classic ASP - Server Time Difference

LEGEND ,
May 30, 2007 May 30, 2007

Copy link to clipboard

Copied

Hi All.

My hosting company's servers are 7 hourse behind UK time.
Is there a way to get my Access Database to adjust the time before it
inserts a TimeStamp?
I'm using now() at the moment for the default value

If this can't be dont in the database, what ASP code would i use to display
the correct date/time?

Thanks in Advance
Andy





TOPICS
Server side applications

Views

629
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 30, 2007 May 30, 2007

Copy link to clipboard

Copied

DateAdd("h",-7,Now())

Subtracts 7 hours from whatever time is reported by the Now() function.


"Andy" <andy@work.com> wrote in message
news:f3k5f9$992$2@forums.macromedia.com...
> Hi All.
>
> My hosting company's servers are 7 hourse behind UK time.
> Is there a way to get my Access Database to adjust the time before it
> inserts a TimeStamp?
> I'm using now() at the moment for the default value
>
> If this can't be dont in the database, what ASP code would i use to
> display the correct date/time?
>
> Thanks in Advance
> Andy
>
>
>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 30, 2007 May 30, 2007

Copy link to clipboard

Copied

On 30 May 2007 in macromedia.dreamweaver.appdev, Andy wrote:

> My hosting company's servers are 7 hourse behind UK time.
> Is there a way to get my Access Database to adjust the time before
> it inserts a TimeStamp?
> I'm using now() at the moment for the default value
>
> If this can't be dont in the database, what ASP code would i use to
> display the correct date/time?

Somebody more familiar with Access will have to comment, but (as far as I
know) a timestamp column takes the system time on insert (and maybe
update), and you can't change that.

What you could do is adjust the time when you use the values:

adjustedTime = dateadd("h", 7, timeFromDatabase)

http://www.drdev.net/article05.asp
http://www.google.com/search?q=time+arithmetic+asp+vbscript
http://www.google.com/search?q=time+arithmetic+access

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

Thanks Guys
if i can't change the timestamp in the Access database, then i need some
code that displays the time/date but minus 7 hours.

Any idea how id do that?
I have this at the moment, but it takes 7 days off

<%=(ContentRS.Fields.Item("TimeStamp").Value)(-7)%>

Thanks
Andy

"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns99408275BDBE7makowiecatnycapdotrE@216.104.212.96...
> On 30 May 2007 in macromedia.dreamweaver.appdev, Andy wrote:
>
>> My hosting company's servers are 7 hourse behind UK time.
>> Is there a way to get my Access Database to adjust the time before
>> it inserts a TimeStamp?
>> I'm using now() at the moment for the default value
>>
>> If this can't be dont in the database, what ASP code would i use to
>> display the correct date/time?
>
> Somebody more familiar with Access will have to comment, but (as far as I
> know) a timestamp column takes the system time on insert (and maybe
> update), and you can't change that.
>
> What you could do is adjust the time when you use the values:
>
> adjustedTime = dateadd("h", 7, timeFromDatabase)
>
> http://www.drdev.net/article05.asp
> http://www.google.com/search?q=time+arithmetic+asp+vbscript
> http://www.google.com/search?q=time+arithmetic+access
>
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/contact.php


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

On 01 Jun 2007 in macromedia.dreamweaver.appdev, Andy wrote:

> if i can't change the timestamp in the Access database, then i need
> some code that displays the time/date but minus 7 hours.
>
> Any idea how id do that?
> I have this at the moment, but it takes 7 days off
>
> <%=(ContentRS.Fields.Item("TimeStamp").Value)(-7)%>

How about dateadd()?

<%= dateadd("h", -7, (ContentRS.Fields.Item("TimeStamp").Value)) %>

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

LATEST
Thanks Joe

That did it :-)

Andy


"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns994246C72F8A5makowiecatnycapdotrE@216.104.212.96...
> On 01 Jun 2007 in macromedia.dreamweaver.appdev, Andy wrote:
>
>> if i can't change the timestamp in the Access database, then i need
>> some code that displays the time/date but minus 7 hours.
>>
>> Any idea how id do that?
>> I have this at the moment, but it takes 7 days off
>>
>> <%=(ContentRS.Fields.Item("TimeStamp").Value)(-7)%>
>
> How about dateadd()?
>
> <%= dateadd("h", -7, (ContentRS.Fields.Item("TimeStamp").Value)) %>
>
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/contact.php


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines