Solved

# julien date to yyyymmdd script needed

Posted on 2003-02-20
Medium Priority
827 Views
I need a script to convert the julien date today's(51) to 2003 03 20 ?  Thanks for the script for date to julien, know I need to get back....any help...

thanks
Leonard
0
Question by:leonardocoe
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

Author Comment

ID: 7989795
thanks
0

LVL 48

Expert Comment

ID: 7990058
I suspect you mean day of year rather than julian date.

Julian date is the number of days since January 1, 4713 BCE
0

LVL 4

Expert Comment

ID: 7990148
what language are you working with?
0

LVL 84

Accepted Solution

ozo earned 200 total points
ID: 7991604
#!/bin/sh
dy=\${1:-`date +%j`}
y=\${2:-`date +%Y`}
l=`expr \( \$y % 4 \| \$y % 100 = 0 \& \$y % 400 \) = 0`
d=`expr \$dy + \( \$dy \> 59 + \$l \) \* \( 2 - \$l \)`
m=`expr \( \$d + 183 \) \* 12 / 367`
d=`expr \$d + 183 - \$m \* 367 / 12`
m=`expr \( \$m + 6 \) % 12 + 1`
echo \$y \$m \$d
0

LVL 51

Expert Comment

ID: 7993409
I'm confused about the "julian date" also, depending on the contry julian calender endet 1582, 1698, 1752, 1918 AC.
So, do you realy mean julian date? then specify which country and which date (gregorian?)
Or do you just mean the (gregorian) date of the year?

Oops, are you using the catholic (as in most western countries), or the cyrillic (modern, as for example in russia) gregorian calender. We need to know this too (at least for some special dates ;-)
0

Author Comment

ID: 7996294
julian date ...

date '+%j'

052

need to change 052 back to 2003 02 21

thanks
0

Author Comment

ID: 8019548
thanks for all the help .... I used ozo comment.
0

Author Comment

ID: 8038657
It worked in my mkstoolkit emulator shell on nt ...thanks!
0

## Featured Post

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
###### Suggested Courses
Course of the Month10 days, 10 hours left to enroll