Re: Julian Date



Unfortunately, "Julian date" isn't really specific: there are several
definitions.

It's also not clear to me exactly what you want your code to do: the two
snippets you've posted do different things (and, for that matter, the second
one won't work, since you've got a literal text string "NumberofDays" where
you need a numeric value: if you've got a variable named NumberofDays,
remove the quotes from around it)

Assuming your definition of Julian date is the 4 digit year followed by a 3
digit number indicating which day of the year it is, you can generate that
as a string using:

Format(MyDateField, "yyyy") & Format(DatePart("y", MyDateField), "000")

If all you want is the day number, you can use Format(MyDateField, "y") to
get a string, or DatePart("y", MyDateField) to get a number.

To convert the 3 digit number back to the date, as mentioned above you need
to use

DateSerial(Year(Date()), 1, NumberOfDays)

Post back with more details of exactly what you're trying to do.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"red skelton via AccessMonster.com" <u15475@uwe> wrote in message
news:599b7adf71d00@xxxxxx
> Hi again,
>
> I found the following exp in a search of this forum. it is:
> DateSerial(Year
> (Date()),1,"NumberofDays"), but when I try it, I get a data mis-match
> error.
> Any idea why? In my table, I have the JulDate set as text vs date so I
> would
> not think that is the problem.
>
> Thanks,
>
> Red
>
> red skelton wrote:
>>Hi everyone,
>>Trying to display a Julian date in a query. I have the VB code to change
>>a
>>calender day to a Julian, but how would I use use this code in a query?
>>The
>>VB code I have came from the Microsoft Access website and it is;
>>
>>Function CDate2Julian(MyDate As Date) As String
>>
>> CDate2Julian = Format(MyDate - DateSerial(Year(MyDate) - 1, 12, _ 31),
>>"000")
>>
>>End Function
>>
>>Can anyone tell me how this would work in a query?
>>
>>Many Thanks
>>
>>Red
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200512/1


.



Relevant Pages

  • Re: from Cents to Hertz and back again
    ... Julian wrote: ... > I do have a gripe with them that they incorrectly identify a perfect ... This is why your guitar's B string is always out of tune ...
    (rec.audio.pro)
  • Re: Why is it dangerous?
    ... Julian writes: ... char *string; ... string = malloc; ... This program, in 16 lines, exhibits at least 6 blatant errors or ...
    (comp.lang.c)
  • Re: source code verification
    ... In my company, we use a SCC string for every source file used, like: ... This way, every time you check in the source file, VSS (or any other SCC ... 20:04 Julian $ ... Icfnt $ ...
    (microsoft.public.vc.mfc)
  • Re: source code verification
    ... In my company, we use a SCC string for every source file used, like: ... This way, every time you check in the source file, VSS (or any other SCC ... 20:04 Julian $ ... Icfnt $ ...
    (microsoft.public.vc.mfc)
  • Re: source code verification
    ... This way, every time you check in the source file, VSS expands "$Header:$" to something ... string is included in the final executable, so later you can check what source files were used to build an exe, dll or ocx. ... 20:04 Julian $ ... Icfnt $ ...
    (microsoft.public.vc.mfc)