Addition to Julian date

Need assistance . Below code gets me julian date . I wanted to add hour/24 to julian date and output it. Is there a way to do the calculation?

use Time::Local;
use POSIX qw(strftime);
my $time=timelocal(1,2,3,9,11,2013);
printf strftime "%j", localtime($time);
343

Do you mean 1 day you want to add to julian day ?

No .Below i have an example

Example

10/24 = .041

Add

343+.041

output

343.041 

just use sprintf

$ cat test
use Time::Local;
use POSIX qw(strftime);
my $time=timelocal(1,2,3,9,11,2013);
printf  sprintf("%f\n",(strftime "%j", localtime($time))+(strftime "%H",localtime($time))/24);
$ perl test
343.125000
1 Like