Julian Date Format

  • Thread starter Thread starter Charles
  • Start date Start date
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?
 
From a post yesterday by Graham Mandeno (ACCESS MVP):

JulianDate = Format([DateField], "yy") _
& Format(DatePart("y",[DateField]), "000")
 
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!
 
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")
 
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?
 
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?
 
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?
 
Back
Top