Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 10th, 2004, 09:11 AM
architgadicherl architgadicherl is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 3 architgadicherl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Specifying the duration of a day

Hi there,
Can someone let me know as to how I can specify the duration (beginning and end ) of a day in Access?
I want Access to calculate values based upon a day that runs from 7 am to 7 am, instead of midnight to midnight.

Thanks
A

Reply With Quote
  #2  
Old February 10th, 2004, 09:58 AM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
In Access when you just specify the date it always represent the beginning of the day i.e. If today is 10th feb 2004 then it repsents 02/10/2004 00.00 AM. So if you use the following command dateadd("s","25200",Date) will give you 02/10/2004 07.00:00 AM. (s represent seconds and 25200 is 7 hrs * 60 min * 60 seconds).

In queries you can use as follows
select Datefield
from table
where datefield between dateadd("s","25200",BeginDate) and dateadd("s","25200",EndDate)
__________________
V.Subramanian

Reply With Quote
  #3  
Old February 10th, 2004, 09:59 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13

Reply With Quote
  #4  
Old February 10th, 2004, 11:57 AM
architgadicherl architgadicherl is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 3 architgadicherl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
system wide date change?

thanks subra and baxter.
however, what i want access to do is:
consider that the beginning and end of every day occurs at 7 am and 6:59 am, as opposed to midnight to midnight.

i.e. 10th feb begins at 7 am and ends at 6.59 am on the following day.

i guess what i am looking for is a systemwide thingie.

Reply With Quote
  #5  
Old February 10th, 2004, 12:03 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
As far as I know that isn't possible.

S-

Reply With Quote
  #6  
Old February 10th, 2004, 08:08 PM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
Yes. Sbaxter is perfectly right. But I dont understand the need for system date side maintenance. As long as you can get report, the way you want, from the data using the techniques mentioned in previous replies where comes the necessity for changing system date. If you can specify your requirement more elaborately probably we can give a suitable suggestion.

Reply With Quote
  #7  
Old February 12th, 2004, 06:13 PM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
Just after a second thought I think I have understood your problem. Your requirement, I feel is, whatever be the time punched by your staff if it falls between 9th feb 2004 7.00 am and 10th feb 2004 6.59 am the worked date should go into table as 9th feb 2004. This requirement normally arises in 3 shift organizations (24X7). If my above explanation is correct
use the following function before updating the table. My suggestion is to have 2 fields to store both punched time and workeddate into the table for future clarification. If i am not clear explain your situation.

Function WorkedDate(DateTimePunched As Date) As Date
Dim DayBeginTime as Date
Dim PunchedDate as Date
Dim PreviousDate as Date
DayBeginTime = Format(DateTimePunched, "short date")
DayBeginTime=DateAdd("s", "25200", DayBeginTime)
PunchedDate=Format(DateTimePunched, "short date")
PreviousDate = PunchedDate-1
If DateTimePunched < DayBeginTime Then
WorkedDate = PreviousDate
Else
WorkedDate = PunchedDate
End If
End Function

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Specifying the duration of a day


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT