LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 03-30-2011, 07:46 AM   #1
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
get julian date for a specific date


hi, i run this command to get todays date in julian form:
Code:
date +%j
089
how would i get that format for e.g.- 12.25.2010 ?

i found this:
Code:
date -d '2007-04-01' +'%Y %j'
but it seems to be linux only

thankx,

Last edited by schneidz; 03-30-2011 at 07:56 AM.
 
Old 03-30-2011, 11:12 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
To be accurate, it's not a "Linux" thing, it's an option offered by the gnu version of date (gnu's tools generally have more options than their various unix counterparts). It is possible to install the gnu tools on other systems, if you're so inclined.

Otherwise I suggest you keep searching the web. I'm sure that there are at least partial solutions for what you want. Perhaps a similar feature can be found in perl or some other language?
 
Old 03-30-2011, 03:33 PM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ yeah, it seems like programming is involved which would be overkill for my needs.

i was hoping for some simple flag to the date command but i guess no joy.
 
Old 04-04-2011, 04:34 PM   #4
trbennett48
LQ Newbie
 
Registered: Apr 2011
Location: Oregon
Posts: 25

Rep: Reputation: 3
You could always use perl...
Here's a starting point for you:

Code:
#!/usr/bin/perl

use Time::Local 'timelocal_nocheck';

if ( $#ARGV+1 != 1 )
{
    printf("Usage: %s yyyy-mm-dd\n");
    exit(1);
}

$input_date = $ARGV[0];

if ( length($input_date) != 10 )
{
    printf("Format Error: Must be yyyy-mm-dd\n");
    exit 1;
}

($i_year, $i_mon, $i_day) = split "-", $input_date, 3;

printf("%s\n", 
   scalar ((localtime timelocal_nocheck 0,0,0,$i_day, $i_mon-1, $i_year - 1900)[7]));
-tony
 
1 members found this post helpful.
Old 04-05-2011, 08:29 AM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ thanks, i was hoping not having to need to program something but i guess like a lot of other things in aix the linux equivalent has many more options.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Julian date from calender date tostay2003 Programming 17 09-03-2012 05:10 PM
date in julian format nanda22 Linux - Newbie 9 09-03-2012 05:00 PM
Julian date converter cheltz Linux - Newbie 1 02-01-2011 09:57 AM
Julian date converter to gregorian date cheltz Linux - General 6 05-04-2010 01:02 PM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 03:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration