PC Review


Reply
Thread Tools Rate Thread

How can I enter and display date in Military format?

 
 
=?Utf-8?B?SklNVw==?=
Guest
Posts: n/a
 
      21st Dec 2005
I'm doing an application in which we wish to enter and display all dates in
Standard Military format. I am using general date format. Date Time Group
is to be entered and displayed as: ddHHnnZmmmyy For example: 011200ZJan06.
The Z is the ZULU or Greenwich Mean Time Zone.
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      21st Dec 2005
Okay, lets start with how Access stores dates, and work towards the
interface you want.

Internally, Access uses a real number to store a date/time value. The
integer part is the date; the fractional part is the time as a fraction of a
day (0.5 = noon; 0.25 = 6am.)

You can display the date/time value in the way you want by setting the
Format property of the text box on your form or report to:
ddHHnn\Zmmmyy

But you will not be able to enter the date/time value like that. You will
therefore need to use an unbound text box to accept the entry, and then use
the AfterUpdate event of that text box to parse the value and write the date
to the date/time field, using Mid(), Len(), DateSerial() and TimeSerial() to
generate the date time value.

On your form, set the Tab Stop property of the real date/time field (named
DT in the example) to No so it does not receive focus when tabbing through
the form. In case the user clicks on it, set its On Got Focus property to
[Event Procedure], and assign its value to that of the unbound entry box:
Me.txtEntry.SetFocus

Set the tab order of the unbound box so it does take focus when DT would
have. In its Got Focus event, copy the value from DT:
If IsNull(Me.DT) Then
Me.txtEntry = Null
Else
Me.txtEntry = Format(Me.DT, "ddHHnn\Zmmmyy")
End If

Then in the AfterUpdate event procedure of the unbound entry box, parse the
string to create a real date/time value (delimited with #), and assign it to
DT.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"JIMW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm doing an application in which we wish to enter and display all dates
> in
> Standard Military format. I am using general date format. Date Time
> Group
> is to be entered and displayed as: ddHHnnZmmmyy For example:
> 011200ZJan06.
> The Z is the ZULU or Greenwich Mean Time Zone.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?SklNVw==?=
Guest
Posts: n/a
 
      21st Dec 2005
Allen:Thanks very much, I'm sure this will deliver what we want. I was kind
of hoping we could handle in in table design, but there is that missing step.
You can tell the system you want the general date and you can determine the
input mask but the step in between - telling it what information it will be
receiving from the field input is missing. Thanks again.


"JIMW" wrote:

> I'm doing an application in which we wish to enter and display all dates in
> Standard Military format. I am using general date format. Date Time Group
> is to be entered and displayed as: ddHHnnZmmmyy For example: 011200ZJan06.
> The Z is the ZULU or Greenwich Mean Time Zone.

 
Reply With Quote
 
Dave Emmert
Guest
Posts: n/a
 
      23rd Dec 2005
You can display date/time in DTG format with the following format:
ddHHnn"Z"mmmyy

However for inputing the date, you will need to input in the general
date/time format: 12/1/2005 12:05:00 PM. You could create a unbounded
textbox that would change the dtg to the long date/time format for the
database, but I think that it would be too much trouble for the effort.

In our offices, we use two different fields, one for dtg as a text field (as
an FYI) and another as a date field (short date format) for queries.

Dave

"JIMW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm doing an application in which we wish to enter and display all dates
> in
> Standard Military format. I am using general date format. Date Time
> Group
> is to be entered and displayed as: ddHHnnZmmmyy For example:
> 011200ZJan06.
> The Z is the ZULU or Greenwich Mean Time Zone.




 
Reply With Quote
 
 
 
Reply

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert military date system to standard date system John Weaver Microsoft Excel Misc 8 17th Sep 2009 06:12 PM
How do I display date and military time in a single field? =?Utf-8?B?Zmxhc2hlczIwMDY=?= Microsoft Access Database Table Design 2 3rd May 2006 05:29 PM
How can I enter and display date in Military format? =?Utf-8?B?SklNVw==?= Microsoft Access 0 21st Dec 2005 04:54 AM
Between [Enter Start Date] and [Enter End Date] =?Utf-8?B?WGVuaWFFYWdsZQ==?= Microsoft Access Reports 0 14th Oct 2004 08:49 PM
Between [Enter begining date] And [Enter ending date] ty Microsoft Access Queries 3 6th Jan 2004 05:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:18 AM.