Ask a Question related to ASP Database, Design and Development.
-
Digit24 #1
Time question - add 15 minutes
I have a time field in an access database and I want to be able to add 15
minutes to it.
I can do this manually by taking the minute, adding 15 and then if it is
over 60, changing the hour, but is there an easier way like with adding a
day to a date by simply adding 1?
Many thanks
Digit24 Guest
-
Convert minutes to Hours and Minutes
Hi There It's getting late and my brain is feeling like a Larne sausage :-) What I want to achieve is to convert a total number of minutes into... -
how to time out the web asp.net application when not in use for 15 minutes
Hi, How to timing out the asp.net web application when not in use for 15 minutes although I am using the code in web.config file as below: ... -
Time Format in datagrid (Hours, Minutes, Seconds)
I have a column in my database that stores total seconds. I want to bind this colum to my datagrid. Is there a way to have the time show as hours,... -
Weird spike in System time every 5:00 minutes...
Hi All, I have what I consider to be an odd behavior on some of my AIX boxes. So far, on most of the AIX servers I have that are running Sybase,... -
Calculate elapsed time in minutes
Try: DateDiff("n",,) Your code has you comparing TaskStart to TaskStart and then dividing the result (which is in minutes from the 'n'... -
Evertjan. #2
Re: Time question - add 15 minutes
Digit24 wrote on 29 apr 2004 in microsoft.public.inetserver.asp.db:
Using MS jet engine you will have to use a plain ASP-vbs loop, I think,> I have a time field in an access database and I want to be able to add 15
> minutes to it.
>
> I can do this manually by taking the minute, adding 15 and then if it is
> over 60, changing the hour, but is there an easier way like with adding a
> day to a date by simply adding 1?
>
with:
newdatetime = DateAdd("n",olddatetime,15)
["n" for minute, "m" for month]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest
-
Bob Barrows [MVP] #3
Re: Time question - add 15 minutes
Digit24 wrote:
UPDATE table> I have a time field in an access database and I want to be able to
> add 15 minutes to it.
>
> I can do this manually by taking the minute, adding 15 and then if it
> is over 60, changing the hour, but is there an easier way like with
> adding a day to a date by simply adding 1?
>
> Many thanks
SET [datefield] = DATEADD("n",15,[datefield])
WHERE <primarykeyfield(s) = some criterial)
HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Roland Hall #4
Re: Time question - add 15 minutes
"Evertjan." wrote in message news:Xns94DA810A1744Feejj99@194.109.133.29...
: Digit24 wrote on 29 apr 2004 in microsoft.public.inetserver.asp.db:
:
: > I have a time field in an access database and I want to be able to add
15
: > minutes to it.
: >
: > I can do this manually by taking the minute, adding 15 and then if it is
: > over 60, changing the hour, but is there an easier way like with adding
a
: > day to a date by simply adding 1?
: >
:
: Using MS jet engine you will have to use a plain ASP-vbs loop, I think,
: with:
:
:
: newdatetime = DateAdd("n",olddatetime,15)
:
: ["n" for minute, "m" for month]
DateAdd Syntax: DateAdd(interval, number, date)
The interval argument can have the following values:
Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
n Minute
s Second
newdatetime = DateAdd("n", 15, now)
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - [url]http://www.microsoft.com/technet/scriptcenter/[/url]
WSH 5.6 Documentation - [url]http://msdn.microsoft.com/downloads/list/webdev.asp[/url]
MSDN Library - [url]http://msdn.microsoft.com/library/default.asp[/url]
Roland Hall Guest
-
Evertjan. #5
Re: Time question - add 15 minutes
Bob Barrows [MVP] wrote on 29 apr 2004 in
microsoft.public.inetserver.asp.db:
Can the jet engine do that?> Digit24 wrote:>>> I have a time field in an access database and I want to be able to
>> add 15 minutes to it.
>>
>> I can do this manually by taking the minute, adding 15 and then if it
>> is over 60, changing the hour, but is there an easier way like with
>> adding a day to a date by simply adding 1?
>>
>> Many thanks
> UPDATE table
> SET [datefield] = DATEADD("n",15,[datefield])
> WHERE <primarykeyfield(s) = some criterial)
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest
-
Bob Barrows [MVP] #6
Re: Time question - add 15 minutes
Evertjan. wrote:
Yes. The Jet engine is able to utilize quite a few VBA functions. There are> Bob Barrows [MVP] wrote on 29 apr 2004 in
> microsoft.public.inetserver.asp.db:
>>>> Digit24 wrote:>>>>> I have a time field in an access database and I want to be able to
>>> add 15 minutes to it.
>>>
>>> I can do this manually by taking the minute, adding 15 and then if
>>> it is over 60, changing the hour, but is there an easier way like
>>> with adding a day to a date by simply adding 1?
>>>
>>> Many thanks
>> UPDATE table
>> SET [datefield] = DATEADD("n",15,[datefield])
>> WHERE <primarykeyfield(s) = some criterial)
> Can the jet engine do that?
several which are considered "unsafe" and therefore not allowed (Replace,
IIF, Nz, etc), but DATEADD is not restricted. You can see the list here:
[url]http://support.microsoft.com/?id=294698[/url]
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Evertjan. #7
Re: Time question - add 15 minutes
Bob Barrows [MVP] wrote on 29 apr 2004 in
microsoft.public.inetserver.asp.db:
Interesting, thanks.> Yes. The Jet engine is able to utilize quite a few VBA functions.
> There are several which are considered "unsafe" and therefore not
> allowed (Replace, IIF, Nz, etc), but DATEADD is not restricted. You
> can see the list here: [url]http://support.microsoft.com/?id=294698[/url]
So I could write:
SQL = "UPDATE tblX SET Dat = DateAdd("h",1,Dat)"
to correct a whole column of field "Dat"?
Is the "SELECT Dat" action intrinsic to UPDATE?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest
-
Bob Barrows [MVP] #8
Re: Time question - add 15 minutes
Evertjan. wrote:
Absolutely. It's safer to surround the column name with brackets, but the> Bob Barrows [MVP] wrote on 29 apr 2004 in
> microsoft.public.inetserver.asp.db:
>>>> Yes. The Jet engine is able to utilize quite a few VBA functions.
>> There are several which are considered "unsafe" and therefore not
>> allowed (Replace, IIF, Nz, etc), but DATEADD is not restricted. You
>> can see the list here: [url]http://support.microsoft.com/?id=294698[/url]
> Interesting, thanks.
>
> So I could write:
>
> SQL = "UPDATE tblX SET Dat = DateAdd("h",1,Dat)"
>
> to correct a whole column of field "Dat"?
idea is correct.
Sorry, but I'm not sure about what you mean by "SELECT Dat" in relation to>
> Is the "SELECT Dat" action intrinsic to UPDATE?
UPDATE queries.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Evertjan. #9
Re: Time question - add 15 minutes
Bob Barrows [MVP] wrote on 29 apr 2004 in
microsoft.public.inetserver.asp.db:>>> SQL = "UPDATE tblX SET Dat = DateAdd("h",1,Dat)"
>>
>> to correct a whole column of field "Dat"?
> Absolutely. It's safer to surround the column name with brackets, but the
> idea is correct.UPDATE, to my simple mind, was a "write to database" action.>>> Is the "SELECT Dat" action intrinsic to UPDATE?
> Sorry, but I'm not sure about what you mean by "SELECT Dat" in
> relation to UPDATE queries.
>
SELECT a "read from database" action.
Now it seems UPDATE can "read-change-write" in one go.
[The name "UPDATE" should have informed me]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest
-
Chris Hohmann #10
Re: Time question - add 15 minutes
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23$Vn6lfLEHA.4052@TK2MSFTNGP11.phx.gbl...There are> Evertjan. wrote:>> > Bob Barrows [MVP] wrote on 29 apr 2004 in
> > microsoft.public.inetserver.asp.db:
> >> >> >> Digit24 wrote:
> >>> I have a time field in an access database and I want to be able to
> >>> add 15 minutes to it.
> >>>
> >>> I can do this manually by taking the minute, adding 15 and then if
> >>> it is over 60, changing the hour, but is there an easier way like
> >>> with adding a day to a date by simply adding 1?
> >>>
> >>> Many thanks
> >>
> >> UPDATE table
> >> SET [datefield] = DATEADD("n",15,[datefield])
> >> WHERE <primarykeyfield(s) = some criterial)
> > Can the jet engine do that?
> Yes. The Jet engine is able to utilize quite a few VBA functions.(Replace,> several which are considered "unsafe" and therefore not allowedhere:> IIF, Nz, etc), but DATEADD is not restricted. You can see the listIIF is allowed. Let's hope that never changes. :) Also it's worth> [url]http://support.microsoft.com/?id=294698[/url]
mentioning that the referenced article in not really applicable to ASP,
but is geared more towards sandboxing user defined function from
external access. For example a call from a Visual Basic app. Remember
this thread?...
[url]http://groups.google.com/groups?threadm=eM7hCy64DHA.2404%40TK2MSFTNGP12.phx .gbl[/url]
HTH
-Chris Hohmann
Chris Hohmann Guest
-
Bob Barrows [MVP] #11
Re: Time question - add 15 minutes
Evertjan. wrote:
I still don't see the word "SELECT" in the example UPDATE statement. But as> Bob Barrows [MVP] wrote on 29 apr 2004 in
> microsoft.public.inetserver.asp.db:>>>>>> SQL = "UPDATE tblX SET Dat = DateAdd("h",1,Dat)"
>>>
>>> to correct a whole column of field "Dat"?
>> Absolutely. It's safer to surround the column name with brackets,
>> but the idea is correct.
>>>>>>> Is the "SELECT Dat" action intrinsic to UPDATE?
>> Sorry, but I'm not sure about what you mean by "SELECT Dat" in
>> relation to UPDATE queries.
>>
> UPDATE, to my simple mind, was a "write to database" action.
>
> SELECT a "read from database" action.
>
> Now it seems UPDATE can "read-change-write" in one go.
>
> [The name "UPDATE" should have informed me]
far as that goes, there is nothing preventing you from using a subquery in
an UPDATE statement:
UPDATE sometable
SET somefield = (SELECT somefield FROM othertable WHERE ...)
WHERE ...
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
fuzzysoftware@calfordgreen.com #12
Re: Time question - add 15 minutes
Yes you do it exactly like adding 1 to th date. In ASP, date and time are all one field, they are not 2 separate fields as in other environments (that I work in anyway). So if adding 1 day is done by " now + 1 " then adding 1 hour would be 1/24th of a day, ie " now + (1/24 * 1) " and 15 minutes might be
" now + ( (1/24) / 60 ) * 15 ". Did it that way to show the calculation, but you can do it various different ways, but the priciple is fractions of 1 day.
Hope this helps
Marcus
************************************************** ********************
Sent via Fuzzy Software @ [url]http://www.fuzzysoftware.com/[/url]
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
fuzzysoftware@calfordgreen.com Guest



Reply With Quote

