Displaying Time Using DateAdd()

I need to display on a web page a 7 day week split up into 30 minute blocks.

I have written the code below to do this. No doubt it is a load of rubbish (I know the bit that prints the days of the week is, but I'm not worried about that for the moment, I'm more concerned about getting the times correct).

The problem is that I cannot get it to print out midnight. The day starts at 00:30:00 and ends at 23:30:00.

Looking at the code below, can anyone suggest how I might be able to do this please?

I know I could just type in something like:

<TD>00:00:00 AM</TD> manually, but I want it to go in via a loop so I can compare it against data that will eventually be pulled from a database.

View Replies


ADVERTISEMENT

Displaying Date Time

With the following code I am trying to simply set and display the current date time in an input box. The input box will not accept a variable that contains any spaces (i.e., a space between date and time). It works if I hardcode a date time, but I need the current date time. The code also works as long as it is not within an input box (see 3rd line below)

<tr><td align="right"><strong>Start Time:</strong></td><td align="left"><input type="Text" name="Start_Time" value=<% =now %> /></td> *THIS ONLY DISPLAYS DAT
<td><% =now %></td> *THIS DISPLAYS BOTH DATE AND TIM
</tr

View Replies View Related

Displaying A Database One Column At A Time

I know how to write a script that will show all the tables fieldnames and then all the tables fields, but how can I do it so that it shows the database table one column at a time? for instance:

fieldname 1
<br>
1st fieldvalue for this column
2nd fieldvalue for this column
3rd fieldvalue for this column
<P>
fieldname 2
1st fieldvalue for this column
2nd fieldvalue for this column
3rd fieldvalue for this column
etc..

View Replies View Related

ASP DateAdd

I'm trying to compare two dates, All I need to see is if the first date is greater than the second date.

I'm fimiliar with how the DateAdd works, I use it often in my SQL Stored Procs, but for ASP it doesnt want to return a value Here's an piece of the code:

If DateAdd(d,DateDiff(d,0,BookingDate),0) > DateAdd(d,DateDiff(d,0,EndDate),0) Then
Flag = 0
Else...

I've also tried just printing out the literal value of the expression but that doesnt return anything either.

Test = Cstr(DateAdd(d,DateDiff(d,0,BookingDate),0))
Response.Write("<b><font color='0000ff'>" & Test & "</font></b>")

Can anyone tell me what I'm missing here?

View Replies View Related

DateAdd

I'm trying to code a drop down for a date entry that gives the user the option of the current date plus the dates of the last 7 days.

<%
for i = -7 to -1
Response.write "<option>" & DateAdd(d,i,Date())
& "<option>"
next
%>
Besides this, even the following code generates an error:

Today=Date()
Response.write DateAdd(d,5,Today)

View Replies View Related

Dateadd()

I need to add 1 day to a specific date. The date have is stored in a variable called "DateOld". The value of the variable have this syntax: mm.dd.yyyy. The new date is the variable called "DateNew".

This is my code that dont work:

DateNew = DATEADD(d,1,DateOld)

What is wrong here? I get this error message: Invalid procedure call or argument: 'DATEADD'.

View Replies View Related

DateAdd

I'm trying to add hours together in the format HH:MM + HH:MM. There doesn't seem to be a functional part of DateAdd that will accomplish this though ?

The calculation is to work out how many hours have been spent on a website so exceeding the 24:00 is fine. Is there another function that would accomplish this?

View Replies View Related

DateAdd Function

This sort of stuff really gets me!I've been using the DateAdd function in various places to return results from the last 3 months e.g.

Code:

SELECT * FROM table WHERE publicationDate > #" & DateAdd("m",-3,now) & "#"


It's been working fine until today when I get into work and suddenly no records are showing up.If I substitute a date from 3 months ago for the function, the records reappear.

View Replies View Related

Dateadd Function Not Adding Up

The code generating the page is as follows:

testdate = "1/29/2003 1:00:00 PM"

while count <> 5
testdate = dateadd("n",15,testdate)
response.write testdate & "<br>"
count = count + 1
wend


What is going on there? The times should be incrementing by 15 minute intervals, not 14min and 59 seconds. I have several pages that have suddenly stopped functioning because of this strange date calculating. My web host insists there is nothing wrong with the ASP service.

View Replies View Related

DateAdd And DatePart Return 13, 14, 15

I'm trying to increment between the end of lunch and the end of the day. The code below is returning a datePart of 13 instead of 1 (for 1:00:00 PM) and 14 instead of 2:00:00 PM etc. If response.write just counter2 I get a real hour. how can I return the actual hour datePart?

lunchStart = "12:00:00 PM"
lunchEnd = "1:00:00 PM"
dayEnd = "5:00:00 PM"
counter2 = cdate(lunchEnd)

while counter2 >= cdate(lunchEnd) AND counter2 <= cdate(dayEnd)
response.write datePart("h",counter2)
counter2 = dateAdd("h",1,counter2)
wend

View Replies View Related

Syntax Of DateAdd Function

Im trying to use the DateAdd and Now() functions so that I can specify some sql statements into my access db. Code:

View Replies View Related

Dateadd And Convert Date Problem

Does any one know how I can use DATEADD and COVERT in the same select statement for retrieving data from a smalldatetime field?

I want to retrieve a date, add a year to it, then convert it to dd/mm/yyyy format without the time showing. It works seperatly EG:

convert date - SELECT adId, CONVERT(CHAR(11),datefrom,103) AS datefrom1 FROM ...
Add date - SELECT adId, DATEADD(year, 1, datefrom) AS dateto FROM....

How do you combine the 2 statements? I have been going slowly mad trying to figure this out

I’m using ASP3.JS and MS-SQL db

View Replies View Related

Time Calculation :: Difference Between Login And Current Time

I would like to display the difference between the logging time
[Session("start"] and the current time [now]. In hours minutes and seconds,
I have tried a couple of things but all I see is gobbledy gook.

View Replies View Related

ASP To Re-load Page From Time To Time To Reset Varaibles

I have a website that I subscribe to that allows me to track tasks. I have an extra computer with a big monitor that i want to always display the task list. the problem is after so many hours I get logged out.

I need to need to reload that sign in url every few hours Code:

View Replies View Related

Comapring Database Time And Computer Date/time

there i was just windering how do i compare a date/time vlaue in sql server agaisnt the computers' date/time.
for example, if computer date/time is two months or 2 weeks before the database date/time do something

View Replies View Related

Time/Date Format And Changing Time To GMT

Currently working on a ASP for a friend, which requires the date and
time on it. It pulls in entries from an Access Database with dates and
times in the format of:

"Fri Oct 17 18:02:46 2003"
However my date and time on the ASP page is displayed as:
"Friday, October 17, 2003 18:02:46"
using the script:
"<%Session.LCID = 1033%>
<%=FormatDateTime(Date(), vbLongDate)%>
<%Session.LCID = 2057%>
<%=time()%>"

Anyone know how to change this script, fully or partly to produce the
date and time on the format that's in the access database i.e. "Fri Oct 17
18:02:46 2003" Code:

View Replies View Related

Time Convert String To OdbcType.Time

I am working on a database that collects information about incidents. One of the fields that people enter is the time of the incident. I am trying to convert that string that people enter into a OdbcType.Time and I am at a lost.

View Replies View Related

Local Machine Time To Eastern Time

How will we convert the system date & time to other timezone for eg: Eastern Time zone using ASP?

View Replies View Related

Time Function Returns Wrong Time

When the Form is submitted I use the Date() and Time() functions to put the date and time into the Body part of the e-mail. The time reported is three hours earlier than the time at which the Form is actually submitted.

I understand these functions are evaluated on the server so the server must be in a time zone three hours earlier than where I am . Is there any way I can get the local time at the location where the user is actually located. ?

View Replies View Related

How To Get Asp Execution Time And Database Connection Time ?

Any some tools or sample codes drop down asp script execute time and
database connection time ?

View Replies View Related

Server Time Local Time Convert

I'm trying to do a very simple code that converts the server time into a time zone of your choice.

<%
dim h 'Current Hour
dim i ' Time Zone Increase - add or subtract hours
dim r 'Result Here
h = Hour(Now)
i = + 2
r = h + i
%>

but obvisouly i'm having trouble with the time zone convert.

View Replies View Related

Compare The NOW Time With A Deadline Time

I am trying to compare the NOW time with a "deadline" time. Please help. Just not sure why this is not working. I need to be able to say IF IT'S BEFORE 9:30 TODAY, IT'S OKAY TO ADD SOMETHING. IF IT'S AFTER 9:30 TODAY, YOU MUST ADD IT TOMORROW.

CODE:

nowtime=now()
deadlinetime=formatdatetime(now(),2) + " 8:30:00 AM"
response.write "NOW: " & nowtime & "<BR>"
response.write "Deadline: " & deadlinetime & "<BR>"
if nowtime<deadlinetime then response.write "can send out today" end if
if nowtime>deadlinetime then response.write "must send out tomorrow" end
if

RESULTS:
NOW: 1/18/2007 8:51:43 AM
Deadline: 1/18/2007 8:30:00 AM
can send out today

As you can see, NOW is GREATER THAN Deadline, so it should must send out tomorrow.

View Replies View Related

Time Calculation :: Between Two Dates And Time

i want to calculate the total time between to dates and time.

Example: Total time elapsed from date 1 time 1 to date 2 time 2.

27/09/2004 11:00 - 28/09/2004 10:30

The user enters a record and then later comes back and closes it. I need to know the time it took from when they entered the record until the time it was closed.

View Replies View Related

Displaying XML

I have XML and XSL documents stored in SQL Server 2000 field. On the asp page i will be getting these documents from the database and then displaying the content of the XML document according to the XSL on the asp page. How can i do this?
Also after getting the documents from the database do i need to store these on the server as .XML and .XSL and then read through these or i can directly read from these document without saving these physically.

Archived XML and XSL documents are attached.

View Replies View Related

Displaying //

I'm pulling data into ASP from Sybase IQ. When the data is in the
database its displayed correctley: //C://.... When I pull it into an
asp page, the formating changes, and a few of my slashes disappear. Is
there a special method of pulling slahes into asp?

View Replies View Related

Displaying XML?

I have this error: [object Error] WinHTTP returned error: 12006 The URL does not use a recognized protocol Code:

View Replies View Related

Displaying The Name

Say i have the following names displayed on a page.

ABCD
CDFG
FGHI

Now if i click on ABCD,this name should get displayed in the text boc.I dont want to have a submit button.

I just want to basically select this name and the moment i select this name ,it gets displayed in the text box and thn i hit submit and the value in the text box hits the DB.

View Replies View Related

Displaying The First 20

I have an access database and users can search through it. Is it possible to display the first 20 results on one page and then display the next 20 on another page and so on and so on..

View Replies View Related

Displaying Message Box!

I have a requirement to display a message and then redirect the controls to
some file, I tried with the below method but its not working, where as If I
use server.transfer or server.execute it works but I cant give relative Url
(it will dynamically genrate), If any one has an alternate way, pls respond.

ShowMessage("Hello World")

Sub ShowMessage(sMessage)
Response.Write "<script> alert("& Chr(34) & sMessage & Chr(34) &" );
</script>"
Response.redirect "xyz.asp"
End Sub

View Replies View Related

Displaying 2DP In Textboxes

When I retrieve this data into standard text boxes (using ASP/ADO) so that
the user can update/file the following problems occur on what I would call
price fields:

10 << I want 10.00

11.6 << I want 11.60

12.89 << this is fine

My MySQL DB holds prices as decimal(10,3) so I know the decimal data isn't
chopped at this point.

Before the data is displayed in these boxes I created the below function to
parse the data before it is written to the boxes: Code:

View Replies View Related

Displaying An Image

I'm sure I'm missing something completely obvious, but I can't figure out what. I have a path to an image file stored in a database. I'm trying to align the image to the right, but nothing seems to be working:

Response.Write("<img src='" & rs("faculty_link_to_photo") &"'>")

dispays the photo without any wrapping, but when I try the following, the images go all over the page:

Response.Write("<img align=""right"" src='" & rs("faculty_link_to_photo") &"'>")

Can someone tell me what I'm doing wrong?

View Replies View Related

IMG Tag Not Displaying Image

I have ASP (classic) code that writes out a table and sets the <img....> tag
with a virtual directory source, e.g. src='/test/imghold/xyz.png', and the
images do not appear on the IE page. The code is from a production site
that works fine.

We just duplicated the web site to one named test and now
the images do not display. The IMG item is in a TD element of a table.
Also, I looked at the "view source" of the page and it shows the <IMG
src='/test/imghold/xyz.png'...> just fine. I even tried it with different
images and none of them show up.

View Replies View Related

Pictures Not Displaying

I have a web page that displays properties for sale. The web page links to a database.

The page shows information in the database and the path to the picture.

The code is:

<p><img border="0" src="file:///D:/HousePics/<%response.write
rsData("id")%>.jpg" width="350" height="262"></p>

the rsData("id")% gives the name of the picture file and appends .jpg to it.

When I browse the page on the local machine the page displays ok and the
graphics show up ok.

When I browse to the page at work the grpahics don't show.

Permissions on the folder 'everyone full control', web sharing is enable
for the site.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved