Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 531
  • Last Modified:

How does Access know when to put AM vs. PM?

We have an Access 2003 database that was created around 1998 in Office 97. We later added a table and form in which people put the start and end times (Medium Time format) for jobs they perform. Because some people had 20 or more entries we did not request that they add AM/PM. We were most concerned about the length of time and could calculate that even if the computer assigned AM when it should be PM. We did not even display that part of the time in the form.
Now we have need for the AM/PM stamp to be correct and that raises the question of what happens when we type 2:35 in the control? How does Access or Windows decide which to put behind the entry? It seems that it guesses well most times but not all times. It is important to understand these entries can be made hours or days later than the times they represent. Any ideas?
0
decraneit
Asked:
decraneit
  • 4
  • 4
  • 3
  • +2
2 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Unless you have used a specific Format, it's determined by the Regional settings in Control Panel.

Keep in mind that ... Access stores dates/times (Date/Time data type) as double precision numbers internally, left of dec pt is the date, right of dec pt is the time.  So ... not sure you need to be concerned.

mx
0
 
KPAYNE123Commented:
I would check the Regional settings for Windows.
0
 
decraneitAuthor Commented:
I realize I failed to make one thing clear. We have formatted the field as Medium Time format so it will have to have either AM or PM behind the number. If all we type is 2:35 and hit enter, how is it decided which to put, AM or PM, behind the 2:35.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
0 to 11:59:59 is AM.
12:00 to 11:59:59 is PM

Data entry It works like this:

2:35  is always AM

If you want PM you must enter:

2:35  PM   or  14:35


If the time span can cross midnight ( 0 ) or the length on a span can be longer than 24 houor you will need to store the date with the time for both stating and ending times..
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
Opps ..

Should have said:

0 to 11:59:59 is AM.
12:00 to 23:59:59 is PM

This is for data entry.

If you are entering tim in 12hour not 24hour notation you must include PM to gt noon or later.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
"how is it decided which to put, AM or PM, behind the 2:35."
It's not. You have to decide.

That's why ... I personally only use 24 hr time.

mx
0
 
GRayLCommented:
If you run this in the Immediate Pane (Alt+F11):

? format(#2:35#,"hh:mm am/pm")
02:35 am
? format(#14:35#,"hh:mm am/pm")
02:35 pm
0
 
decraneitAuthor Commented:
OK, here is the form with some entries I have made. Things were going swimmingly as I entered the first 6 entries, but on the 7th entry I got 4:30 AM even though I had been gatting PM right before that. I confess I have been fooling around with some code to try to logically determine the most likely choice but I was having similar experiences before I started checking the entries. Notice the two highlighted, in green, entries
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
I agree with mx. Access does not decide AM/PM. It takes whatever you enter.

I only use 24 hour time for data entry.  Eliminates the confusing.
0
 
GRayLCommented:
Another thing, you've had the guy on the job since 4:00 am and it looks like you haven't allowed him/her to take breakfast or lunch;-)  It looks like once you enter the Start Time for the first Job of the day for that person, when you go to a new record, the only thing you should have to fill in is the End Time as the Start Time is always the End Time of the previous record.  Is that automated?
0
 
GRayLCommented:
Thanks, glad to help.  
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
I just wanted to note that .. the actual answer to the question "How does Access know ..."  is @ http:#a35218963 :-)

IE ... Access does not.

mx
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
I agree with mx.
0
 
decraneitAuthor Commented:
Sorry, but I got busy and missed out on some of this last discussion. In retrospect, your decision is the correct one - I apologize for not seeing that the first time. Thanks.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 4
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now