Solved

Convert Julian date to 12 month calendar date

Posted on 2014-09-15
10
598 Views
Last Modified: 2014-09-16
I'm using Access to connect to the Pervasive database using ODBC. I have some tables that contain a Julian Calendar date which I need to convert to a regular 12 month calendar date

PERIOD_01 = 2012213 which is August the 1st 2013 and I want in date format.

I'm using this Julian calendar here for reference. http://www.fs.fed.us/fire/partners/fepp/julian-calendar.pdf
0
Comment
Question by:Gerhardpet
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40323972
see the codes from this page from M$
How to Convert Julian Days to Dates
0
 
LVL 28

Expert Comment

by:Bill Bach
ID: 40323981
Use the PSQL function DateAdd() to subtract the known value (supply the value as a nagative) from the known date. This will give you the starting date for the calendar. From there, use the same function, but supply the starting date and use positive values, and it should calculate it for you. If you are not sure how to use the DateAdd function, start the Pervasive Control Center, then help/docs, then search for DateAdd.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40324035
Here is a one-liner:

j = 2013213
datDate = DateSerial(j \ 1000, 1, j Mod 1000)

=> 2013-08-01

/gustav
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 40324128
I would rather do this in Access since I'm able to do much with my queries that I can when running them in PCC

@Gustav Brock: Can you give me a bit more details? Not sure what to do with what you have posted.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40324138
Don't know what you wish to do, but for example a Query:

Select *, DateSerial([YourDateFieldName] \ 1000, 1, [YourDateFieldName] Mod 1000) As TrueDate
From tblYourTable

/gustav
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40324241
@Gerhardpet

did you look at the codes from the link I posted?



.
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 40324450
@gustav.

That worked

How would I add + 1 now? I want the date +1 day?

@ Rey - Yes I did but I mostly rely on Access to do the queries for me so I could not make much out of the link.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 40324842
That's easy. Modify the day parameter of DateSerial:

Select *, DateSerial([YourDateFieldName] \ 1000, 1, [YourDateFieldName] Mod 1000 + 1) As TrueDate
From tblYourTable

/gustav
0
 
LVL 1

Author Closing Comment

by:Gerhardpet
ID: 40326729
@gustav

That worked great! Thanks for your help!
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40327327
You are welcome!

/gustav
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now