Julian Date Format

C

Charles

Does anyone know how to get Access to format a date field in the Julian Date
Format? The Julian Date Format is YYDDD, but when I type in YYDDD in the
format property, it spits out "04Mon" but its suppose to spit out "04033"
since today (Feb 02, 2004) is the 33rd day of the year. Any idears?
 
K

Ken Snell

From a post yesterday by Graham Mandeno (ACCESS MVP):

JulianDate = Format([DateField], "yy") _
& Format(DatePart("y",[DateField]), "000")
 
C

Charles

Also, I have to make it so that when it does spit out the proper format, I
need it be zero filled in the day section. For example for dates between
"January 1, 2004 to January 9, 2004" it would need to format it and output
it as "04001 to 04009" not "041 to 049". Hope this makes sense!
 
J

John Vinson

Does anyone know how to get Access to format a date field in the Julian Date
Format? The Julian Date Format is YYDDD, but when I type in YYDDD in the
format property, it spits out "04Mon" but its suppose to spit out "04033"
since today (Feb 02, 2004) is the 33rd day of the year. Any idears?

If you check the online help for Format (and do some digging) you'll
see that the format expression for day-of-year is "y", and that "ddd"
in fact is the abbreviated day name.

I don't think there's a single format expression that will do what you
want - "yyy" gives 0433 (should be 04033).

Try

Format([datefield], "yy") & Format(DatePart("y", [datefield]), "000")
 
C

Charles

Thanks Ken, sorry for the repeat question, I just havn't had a chance to
look at the posts this morning that occurred over the weekend. Again,
thanks for your help!

Ken Snell said:
From a post yesterday by Graham Mandeno (ACCESS MVP):

JulianDate = Format([DateField], "yy") _
& Format(DatePart("y",[DateField]), "000")

--
Ken Snell
<MS ACCESS MVP>

Charles said:
Does anyone know how to get Access to format a date field in the Julian Date
Format? The Julian Date Format is YYDDD, but when I type in YYDDD in the
format property, it spits out "04Mon" but its suppose to spit out "04033"
since today (Feb 02, 2004) is the 33rd day of the year. Any idears?
 
C

Charles

Worked perfectly! Thanks Ken, your a life saver, as usual! can I buy ya a
beer someday!

?
Ken Snell said:
From a post yesterday by Graham Mandeno (ACCESS MVP):

JulianDate = Format([DateField], "yy") _
& Format(DatePart("y",[DateField]), "000")

--
Ken Snell
<MS ACCESS MVP>

Charles said:
Does anyone know how to get Access to format a date field in the Julian Date
Format? The Julian Date Format is YYDDD, but when I type in YYDDD in the
format property, it spits out "04Mon" but its suppose to spit out "04033"
since today (Feb 02, 2004) is the 33rd day of the year. Any idears?
 
K

Ken Snell

Thanks go to Graham, it's his code.

I appreciate the gesture, but I don't drink alcoholic beverages.... ! ;-)

--
Ken Snell
<MS ACCESS MVP>

Charles said:
Worked perfectly! Thanks Ken, your a life saver, as usual! can I buy ya a
beer someday!

?
Ken Snell said:
From a post yesterday by Graham Mandeno (ACCESS MVP):

JulianDate = Format([DateField], "yy") _
& Format(DatePart("y",[DateField]), "000")

--
Ken Snell
<MS ACCESS MVP>

Charles said:
Does anyone know how to get Access to format a date field in the
Julian
Date
Format? The Julian Date Format is YYDDD, but when I type in YYDDD in the
format property, it spits out "04Mon" but its suppose to spit out "04033"
since today (Feb 02, 2004) is the 33rd day of the year. Any idears?
 

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