Solved

Convert Julian date to 12 month calendar date

Posted on 2014-09-15
10
587 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

21 Experts available now in Live!

Get 1:1 Help Now