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


ADVERTISEMENT

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

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

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

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







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