Solved

Convert Julian date to 12 month calendar date

Posted on 2014-09-15
10
606 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Read about achieving the basic levels of HRIS security in the workplace.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

810 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