DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

Thread: How to Convert the Julian Date to Normal Date?

1. Craig Brown Guest

Re: How to Convert the Julian Date to Normal Date?

Maford,

I did a quick test and a quick search of the VB help facility but did not
find anything 'satisfactory'. You can, however, use an array to "convert"
your day to month-day. The values in your array would be the total number
of days in the year, up to, but not including the current month, for non
leap years: #1 = 0, #2 = 31, #3 =59, #4 = 90, etc. Search the array for
the value that is lower(!) than your day, if your array has option base 1
then, the entry will represent the month. Your loop would have something
like:
If myJDays > Array(x) Then
x = x - 1
Exit For
End If

Subtract the array entry from your day to get the day of the month.

You can also use the array to convert mm-dd back to Julian by adding the
array entry(month) to the day of the month, e.g. 01-23 would be array(1)
+ 23 or 0 + 23 = 023; 02-02 would be array(2) + 2 or 31 + 2 = 033; etc.

I would put the whole business in a class module that I could use to do it
for me... (Maybe I'll write one today....)

There are, definitely, other ways to do this, but this will at least work.

Craig Brown

"Maford" <mayee_yra@hotmail.com> wrote:
>Hi.
>
>Does anyone know how to convert the Julian Date to Normal Date in Visual
>Basic 6?
>
>Mayee
>
>

2. Alan Gillott Guest

Re: How to Convert the Julian Date to Normal Date?

Use DateAdd. 1=Jan 1 so for 01257 Add 257 days to 31 Dec 2000.

"Maford" <mayee_yra@hotmail.com> wrote in message
news:3abb21ba@news.devx.com...
> Hi.
>
> Does anyone know how to convert the Julian Date to Normal Date in Visual
> Basic 6?
>
> Thanks in advance.
> Mayee
>
>

3. Maford Guest

How to Convert the Julian Date to Normal Date?

Hi.

Does anyone know how to convert the Julian Date to Normal Date in Visual
Basic 6?

Mayee

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 FAQ Latest Articles Java .NET XML Database Enterprise
 Questions? Contact us. C++ Web Development Wireless Latest Tips Open Source

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.