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


ADVERTISEMENT

DatePart

Is it possible to pass a variable containing the full date and time to 'DatePart'? I want to grab just the time of day portion of a date. As in: Code:

<%
dim submit_date
submit_date = Now()

submit_time = DatePart("h","n","s", submit_date)
%>

View Replies View Related

How To Use The DatePart Function?

Does anyone know how to use the DatePart function?

View Replies View Related

DatePart Query

i am trying to use the DatePart function on my SQL2000 database. I have a table called visitors with a field called DateTimeEntrance which is filled everytime a visitor enters the site. I am trying to build a stat page where i display the total amount of visitors per day, week, month, year and i can't seem to get the syntax correct.

I get an error with the following code:

sql = "SELECT * FROM tblVisitors WHERE (DatePart("yyyy",
[datetimeentrance])) = (DatePart("yyyy", date()))"

can anyone help me with the correct syntax?

View Replies View Related

DatePart Wrong Code

Is there anything wrong with my code (see below) bcoz when 10p-6a shift my
browser returns the error cannot be a zero-length string. Im wondering why,
bcoz the 2 other shift works perfectly.

<%
'Shift: 6a-2p
if DatePart("h", Now()) 5 And DatePart("h", Now()) < 14 then
ShiftID = "A"
end if

'Shift: 2p-10p
if DatePart("h", Now()) 13 And DatePart("h", Now()) < 22 then
ShiftID = "B"
end if

'Shift: 10p-6a
if DatePart("h", Now()) 21 And DatePart("h", Now()) < 6 then
ShiftID = "C"
end if
%>

View Replies View Related

Datepart Function :: Remove Weekdays Name

i used formatdatetime(dt,vblongdate).it gives me in format like monday , august 8th, 2005.but i dont want weekday means monday or tuesday in my date so on.

<%
prior = Request("Date")

if isDate(prior) Then prior = CDate(prior) Else prior = #1/1/1900#

For dt = DateAdd("m",-1,Date()) To Date-1

%>
<OPTION value="<%=dt%>" <%If dt = prior Then response.write "SELECTED" %>><%=FormatDateTime(dt, vbLongDate)%> </option>
<%
Next
%>
</SELECT></center> </td>
</tr>

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

DatePart Function :: Displaying Dates From Monday To Friday

I'm trying to use DatePart and Datediff functions to show the formatted m/dd/yyyy display for the dates of Monday and Friday of the current week. I want it to display as:

Our Weekly Schedule 8/23/2004 thru 8/27/2004:

Can't pinpoint the parameter to check for the current week. Is there a good reference anywhere to show how to use the methods and such of both datepart and datediff, or has anyone programmed something similar prior.

View Replies View Related

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

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

Return From ASP.NET To ASP

I updated to aspx last three month,after developing serveral
applications,Idecided to downgraded to asp, following is my reasons:
1.in ASPX,the page format is hard to control,in ASP u can change every html
as u like ,but in aspx, a aspx control decide the page format,and its hard
to change the format.

2.ASPX is said to be faster that asp, but it is based on too-often
communication back to the server,for example,u click a radio a button,there
is new page request, but in reality,such a communication is
bandwidth-consuming and time-consuming. the user only need to submit the
form, and the exchange between IE and Server was minimazed.
the Speed of ASPX is not useful for most sites, for bigger sites, the speed
increase is singnificant,but for small sites with less traffic, the speed of
ASP is quite enough.

3.ASPX is based on Object Orinted Programming, but in most small sites,
Procedure orinted programming is used, we never build objects, and POP is
more efficient.ASPX is for three-tiered structure with a single layer of
business logic component, but in reality, most of us used two-tier
structure,that is Presetation layer and Datalayer, we can layout the page
and change the database in a single page, quite effienct too.

View Replies View Related

404 Return

I want to return a 404 response from an ASP script (IIS 5).

Response.Status lets me set the response string, but if I don't include any
HTML text myself, the result is an empty page.

Is there a way to 'redirect' it to the server's default 404 response, as if
the URI really doesn't exist, but without really redirecting it so the URL
isn't replaced in the browser's address bar?

View Replies View Related

Return Value

I am trying to replace a huge chunck of code that currently I incorporate
with an #Include directive. The program rarely has to flow through that
code, so I thought it would be better if I used Server.Execute.
I found I can pass data TO the called asp file by creating an HTML <input>
and erading it after I get there.
However, I also need to read back ONE variable that the called file must
set. I cannot figuer out how to do that. My backup positions are (1) I can
keep on using the #Include technique, and (2) I can use a database to bridge
the gap.Isn't there a way to carry data BACK TO the calling asp file FROM
THE CALLED asp file?

View Replies View Related

Return A Value

I am using a stored procedure to insert set of values to a table.I am generating or calculating the value of the primary key and inserting that record and i need that value to use in my application so is there any possibilty to return a value from storedprocedure to asp application.

what i am using to do is creating a #temp table and inserting that value in the sp and then opening that value in the asp application and droping that table, but i hope it is not a efficient method.

View Replies View Related

Log In Return

When a user logs in, I want to redirect them to the page that they were previously on. How do I do that? I already have the login page working. I just need to edit the redirect part.

View Replies View Related

Return Value

The code bellow functions well. However if I want to obtain a return
value using the code bellow, how is it done? Code:

View Replies View Related

Return Single Value In Asp/sql

I'm assuming this can be done, but I can't seem to get it to work... I'd
like to easily return a single value from a sql statement, something like:

"intNewItems = conn.execute "SELECT COUNT (ItemID) WHERE ItemDate = Date()",
where conn is the connection object, etc. What am I getting wrong?

View Replies View Related

Return Recordset

There is an access database and asp page .That asp page opens connection with that database,And opens a recordset online..

Is there any way that this opened recordset can be returned to Vb6 application which requested that Asp page to open connection and recordset and return some result.

View Replies View Related

Return Entire Row(s

I know there's a way to do this - well 99% sure anyway - and seem to remember reading an article or tutorial about how to do it but I'm not having any luck finding it.
What I need to do (using MySQL & ASP3) is to find all rows with "X" as a non-unique ID - there may be 30 or so total - and grab them to be archived in a CSV file before deleting the record from a DB.The reason I want to avoid hardcoding the field names is that they're going to change with moderate frequency.

View Replies View Related

Return A Checkbox

How do I return the true/false value from the database to be either a checked or unchecked box using ASP?

View Replies View Related

FormElement Return

I just need to understand how the following line returns its values.Code:
Dim Var
For each FormElement in Request.Form

Var = Request.Form(FormElement)

Next
You see say I have 5 form elements on an html form.

Element One
Element Two
Element Three
Element Four
Element Five
I know that it is not checking the names of the elements and producing the results in that order, I know its not running through the Elements top to bottom on the form.

So in what order does FormElement return the values and based on what?

View Replies View Related

Carriage Return

am trying to make a carriage return of the following:

Mailer.BodyText = "From: " & Request.Form("FRM") & VbCrLf & VbCrLf & "Message: " & Request.Form("MSG")

but it doesnt work.

when i received the email on my mailbox, the format is all in one line, like this:

From: John Message: Test message only

but i would like the "Message:" to appear in the second line.

View Replies View Related

Duplicate Return On Rs

in my SQL select query I have a LEFT JOIN between 2 tables that returns a
value if the data from table 1 is present in table 2, below

dbo.booking_form.COLL_CONTACT_TEL = dbo.tblFlag.TelNoMo OR
dbo.booking_form.MOBILE_NO = dbo.tblFlag.TelNoMo

Problem is that if the COLL_CONTACT_TEL and MOBILE_NO are both present in
table 2 it returns the record twice in the asp page repeat region.

View Replies View Related

Return A Value From An ASP Popup

I want to create a pop up asp page something like:

popUp('myasp.asp',.......)

and when the user closes the popup can I return a value. So sudo code would be like

myJavaScript
int temp = popUp('myasp.asp;,.............. /* Temp is the value returned by myasp.asp
set some textfield to have value temp.
end

Is this possible?

View Replies View Related

Use 'return' In A Function

When should we use 'return' in a function to return the result versus 'FunctionName = result'

View Replies View Related

Return A Value From Function

Code:
function findcinemaid(nameofthecinema)
findcinemaid = "select cinemasid from cinemas" &_
" where brand = 'tgv' and cinemaplace2 like '"&nameofthecinema&"'"
set cinemaidfound = objconndb.execute (findcinemaid)
optainedcinemaid = cinemaidfound("cinemasid")
end function

tgvcinemanamexcel = "[1u_f$]"
cinemaname = "ONE UTAMA"
findcinemaid(cinemaname)
response.write optainedcinemaid

if I put response.write inside funciton it will display the cinemaid properly but if I put it outside , it wont display

View Replies View Related

Return Results

My SQL statement won't return results where any field in a record is blank. What can I do to fix this?

strSQL = "SELECT * FROM newarchive WHERE Program_Title LIKE '%" & program & "%' AND Year_Aired LIKE '%" & yearA & "%' AND Sponsor LIKE '%" & sponsor & "%' AND Month_Aired LIKE '%" & monthA & "%' ORDER BY ID"

It gets its values from a form where some fields can be left blank. If the record itself does not have a blank field, the search will pick it up. But if the record contains a blank field, then it won't be selected unless it matches the Program_Title data.

View Replies View Related







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