LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Julian date converter (https://www.linuxquestions.org/questions/linux-newbie-8/julian-date-converter-860014/)

cheltz 02-01-2011 09:49 AM

Julian date converter
 
I have this method to convert Julian TIme to normal time via Perl.
(i.e)

#!/usr/bin/perl
$epochseconds="@ARGV[0]";
($second, $minute, $hour) = gmtime($epochseconds);
print sprintf("%02d:%02d:%02d\n", $hour, $minute, $second);



Does anyone know a way to convert the "DATE" also in perl?


Thank You in advance for helping out

Snark1994 02-01-2011 09:57 AM

What do you mean by "Julian Time"? If you mean the Julian Calendar, then it doesn't seem like that's what your programme is doing... It's working out the Gregorian date/time based on the input.

However, this is the output format for the gmtime function, so you can grab the day/month/year... Then, whatever non-Gregorian calendar you're trying to get to, you just need to work backwards towards the epoch making corrections :)


All times are GMT -5. The time now is 09:52 PM.