Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2005, 11:33 PM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with Date time adjustment

I posted this in another forum but got no replies so..

 I am using this piece of code to show a date and time :-

<%
Dim objFSO
Dim objFile
Dim dateModified
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(Server.MapPath("sradmin1.asp"))
dateModified = objFile.DateLastModified
%>
<div>
<br />
Last Modified &nbsp;<%= FormatDateTime(dateModified, 1) %>; at <%= FormatDateTime(dateModified, 3) %><br />
</div>
<%
Set objFile = Nothing
Set objFSO = Nothing
%>

Trouble is my Hosting Company server is 14 hours behind me and I would like it to reflect my Date and Time when giving me a result on a webpage

Can anyone help please

Thanks Roy ...
 
Old April 18th, 2005, 11:50 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

To reflect the data and time to be displayed correctly set the culture of the Hosting Company Server in your asp.net page.


 
Old April 19th, 2005, 05:14 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the quick reply, perhaps I should have stated I am using plain old ASP, not .net unfortunatly

Thanks Roy...
 
Old April 19th, 2005, 03:09 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

have you look DATEADD function

to offset 14 hrs. you can do

DATEADD(h,-14,dateModified)
 
Old April 20th, 2005, 04:45 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you both for your replies I am not the smartest programmer, I only came in here because I could not get an answer on the other forum.

I have tried using dateADD on Last Modified &nbsp;<%= FormatDateTime(dateModified, 1) %> but I cannot get ther syntax correct

I just know nothing about Culture, I have never even heard of it until you mentioned it

Could you explain or point me to some sample code perhaps

THanx Roy..
 
Old April 20th, 2005, 07:15 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;I only came in here because I could not get an answer on the other forum
For ASP help try here first next time. In my experience the members here are not only helpfull, also a very smart bunch.

;;;I have tried using dateADD, but I cannot get ther syntax correct
The example you were given is slightly wrong change:
DATEADD(h,-14,dateModified)
to
DATEADD("h",-14,dateModified)

Here is a cut n paste example of using the date add function how I believe you need to use it:
<%
  dim serverDVal,localDVal
  serverDVal = now()
  response.write serverDVal & " = The server date<bR>"
  localDVal = DATEADD("h",-14,serverDVal)
  response.write localDVal & "= The server date minus 14 hours<br>"
%>

;;I just know nothing about Culture, I have never even heard of it until you mentioned it
I am not aware of a culture function, I do not think there is on in VBScript, what 'gets the culture' is the:
"GetLocale Function:
Returns the current locale ID value.
A locale is a set of user preference information related to the user's language, country, and cultural conventions. The locale determines such things as keyboard layout, alphabetic sort order, as well as date, time, number, and currency formats."

There are loads of examples on the web. I think this is overkill for what you want and suggest you use the date add function.





Wind is your friend
Matt
 
Old April 21st, 2005, 04:38 PM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you all so much for your help, now I can try a few things and find out what works best for me

Regards Roy...

 
Old April 21st, 2005, 06:35 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Santhi
I dont think topshed is writting c# and using .net - this is the classic ASP area of this forum...

Wind is your friend
Matt
 
Old May 2nd, 2005, 06:12 PM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Guys,

I finally got it , I must be getting to old for all this stuff

Refgards Roy..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting Time from Date/Time Navy1991_1 XSLT 2 June 3rd, 2008 12:03 PM
date and time in EST time zone anboss XSLT 1 May 21st, 2008 01:42 PM
help on zone time adjustment kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 October 30th, 2006 11:34 PM
How to retieve only the date not date and time debjanib ASP.NET 1.0 and 1.1 Professional 2 July 25th, 2006 01:10 PM
insert system date. no date and time jimmy Access VBA 6 November 20th, 2003 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.