Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: getting host server date time


Message #1 by Nusrat Sarwar <nusrat286@y...> on Thu, 24 Oct 2002 13:05:01 -0700 (PDT)
function SetDomain(d) { document.domain = d; }Hi there

Hope all of you are well and fine

I want that when my user fills the form and the entries will be stored in the DB (which is doing fine) 

the question is that I want my host server date to be inserted in the DB as I want the date time when the user has filled the form

so how I would get the date and time of my host server through asp?

i will be more than happy for a prompt answer.

waiting for one 

many thanx in advance

take care

regards

nusrat

 



---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
Message #2 by "Scott Heath" <scott@s...> on Thu, 24 Oct 2002 15:57:25 -0500
Nusrat,
Here is the code I use when doing date/time. Since the time from the
server is in 24hr format I convert it to 12 hr and add the AM/PM on to
it for ease of reading it.

==Begin Code==

'Date code
'Format the time of day (and day as the case may be)
dHour = Hour(Now)
	If dHour => 12 Then
		fHour = dHour - 12
		AMPM = "PM"
	else fHour = dHour
		AMPM = "AM"
	End If
If fHour = 0 Then fHour = 12
dMinute = Minute(Now)
	If LEN(dMinute) = 1 Then
		dMinute = "0" & dMinute
	End If

dSecond = Second(Now)
	If LEN(dSecond) = 1 Then
		dSecond = "0" & dSecond
	End If

dDate = (Date)

TME = fHour & ":" & dMinute & ":" & dSecond & AMPM

==End Code==

Scott
 
Website      | http://www.scottspad.com
E-mail       | scott@s...
Alpha Pager  | www.scottspad.com/phone.asp
--------------------------------------------
There are 10 types of people in the world,
those that can read binary and those that can not.

-----Original Message-----
From: Nusrat Sarwar [mailto:nusrat286@y...] 
Sent: Thursday, October 24, 2002 3:05 PM
To: ASP Web HowTo
Subject: [asp_web_howto] getting host server date time


function SetDomain(d) { document.domain = d; }Hi there

Hope all of you are well and fine

I want that when my user fills the form and the entries will be stored
in the DB (which is doing fine) 

the question is that I want my host server date to be inserted in the DB
as I want the date time when the user has filled the form

so how I would get the date and time of my host server through asp?

i will be more than happy for a prompt answer.

waiting for one 

many thanx in advance

take care

regards

nusrat

 



---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20


Message #3 by "Ken Schaefer" <ken@a...> on Fri, 25 Oct 2002 11:32:59 +1000
www.adopenstatic.com/resources/code/formatdate.asp
is a more flexible way to do this...

<%
dteTimeNow = Now()
'
dteNiceTimeNow = FormaDate(dteTimeNow, "%h:%n %P")
'
Response.Write(strNiceTimeNow)
%>

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Scott Heath" <scott@s...>
Subject: [asp_web_howto] RE: getting host server date time


: Nusrat,
: Here is the code I use when doing date/time. Since the time from the
: server is in 24hr format I convert it to 12 hr and add the AM/PM on to
: it for ease of reading it.
: 
: ==Begin Code==
: 
: 'Date code
: 'Format the time of day (and day as the case may be)
: dHour = Hour(Now)
: If dHour => 12 Then
: fHour = dHour - 12
: AMPM = "PM"
: else fHour = dHour
: AMPM = "AM"
: End If
: If fHour = 0 Then fHour = 12
: dMinute = Minute(Now)
: If LEN(dMinute) = 1 Then
: dMinute = "0" & dMinute
: End If
: 
: dSecond = Second(Now)
: If LEN(dSecond) = 1 Then
: dSecond = "0" & dSecond
: End If
: 
: dDate = (Date)
: 
: TME = fHour & ":" & dMinute & ":" & dSecond & AMPM

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #4 by Nusrat Sarwar <nusrat286@y...> on Fri, 25 Oct 2002 11:21:09 -0700 (PDT)
Hi everyone
Many many thanx for all your help Ken and Scott.
God bless you.
Take good care of yourselves
Regards
nusrat
 
 Ken Schaefer <ken@a...> wrote:www.adopenstatic.com/resources/code/formatdate.asp
is a more flexible way to do this...

dteTimeNow = Now()
'
dteNiceTimeNow = FormaDate(dteTimeNow, "%h:%n %P")
'
Response.Write(strNiceTimeNow)
%>

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Scott Heath" 
Subject: [asp_web_howto] RE: getting host server date time


: Nusrat,
: Here is the code I use when doing date/time. Since the time from the
: server is in 24hr format I convert it to 12 hr and add the AM/PM on to
: it for ease of reading it.
: 
: ==Begin Code==
: 
: 'Date code
: 'Format the time of day (and day as the case may be)
: dHour = Hour(Now)
: If dHour => 12 Then
: fHour = dHour - 12
: AMPM = "PM"
: else fHour = dHour
: AMPM = "AM"
: End If
: If fHour = 0 Then fHour = 12
: dMinute = Minute(Now)
: If LEN(dMinute) = 1 Then
: dMinute = "0" & dMinute
: End If
: 
: dSecond = Second(Now)
: If LEN(dSecond) = 1 Then
: dSecond = "0" & dSecond
: End If
: 
: dDate = (Date)
: 
: TME = fHour & ":" & dMinute & ":" & dSecond & AMPM

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20


---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site

  Return to Index