 |
| 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
|
|
|
|

April 18th, 2005, 11:33 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 <%= 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 ...
|
|

April 18th, 2005, 11:50 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
To reflect the data and time to be displayed correctly set the culture of the Hosting Company Server in your asp.net page.
|
|

April 19th, 2005, 05:14 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the quick reply, perhaps I should have stated I am using plain old ASP, not .net unfortunatly
Thanks Roy...
|
|

April 19th, 2005, 03:09 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
have you look DATEADD function
to offset 14 hrs. you can do
DATEADD(h,-14,dateModified)
|
|

April 20th, 2005, 04:45 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 <%= 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..
|
|

April 20th, 2005, 07:15 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;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
|
|

April 21st, 2005, 04:38 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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...
|
|

April 21st, 2005, 06:35 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
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
|
|

May 2nd, 2005, 06:12 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Guys,
I finally got it , I must be getting to old for all this stuff
Refgards Roy..
|
|
 |