Julian date format

G

Guest

I'm wanting to use the Julian date format (YYDDD - common to the military) for use in my tables and forms. The fields will return the format, however, I am unable able to enter the date in Julian format - I have to enter it in a standard format. What do I need to do to resolve this? Also, when the fields return the Julian date format, access omits the "0's" if the current day is <100 and it returns the 2 digit year. Can I force access to return the "0's" and only include a single digit for the year?
 
T

Tim Ferguson

I'm wanting to use the Julian date format (YYDDD - common to the
military) for use in my tables and forms.

bad idea: I would store the date as a proper datetime value, and present it
to the user formatted as required. You lose all kinds of functionality
(dateadd, firstofthemonth etc etc) by ditching the basic data type.
The fields will return the
format, however, I am unable able to enter the date in Julian format -
I have to enter it in a standard format.

This too.
What do I need to do to resolve this?

As I said above, store the thing in a datetime field. On the form or
report, you can convert it to a compound as you said above by putting this
in the controlsource of the text box:

= Format(MyDateField, "yy") & Format(MyDateField, "y")
Also, when the fields return the Julian date format,
access omits the "0's" if the current day is <100 and it returns the 2
digit year. Can I force access to return the "0's" and only include a
single digit for the year?

Quite right. try this (all one one line, of course):-

= Format(MyDateField, "yy") &
Right("000"& Format(MyDateField, "y"),3)

By the way, you do really want the century digits in, don't you..?

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top