cancel
Showing results for 
Search instead for 
Did you mean: 
jeesshnasree
Starfighter Starfighter
Starfighter
  • 4,970 Views

how to find the current week number with 'cal' command in linux and current week days

Jump to solution

hi all,

 

i tried and there is ncal command  and leave about ncal command one of the Linux OS.

Currently my requirement to find the current week number with 'cal' command , current day count  of the year and that week related days(from Monday to Sunday) .

if any one knows , could you please share . i tried with 'cal' command but unable to print current week number and current day of the year . 

 

if possible , could you please share . its for general purpose  .

Currently checked  on   RHEL - 7.6 (Maipo) 64-BIT  one of the machine and ignore the version of the OS and need to use with cal command . i think might be some options are not installed properly . but 'cal' command is working as good . so please provide above request .

i hope clearly explained about my issue . 

i am waiting for your valuable reply .

 

Regards,

Jeesshansree

1 Solution

Accepted Solutions
Alexandre
Starfighter Starfighter
Starfighter
  • 4,958 Views

Hello

Here is two variants of answer to your question:

1) cal -jw  give you a pseudo-graphical answer, not numerical

2) date +%j   ;  date +%U  ;  date +%u  give you answer n numerical form. Be carefull with date +%U - number of weeks start with 00, not traditional 01

View solution in original post

2 Replies
Alexandre
Starfighter Starfighter
Starfighter
  • 4,959 Views

Hello

Here is two variants of answer to your question:

1) cal -jw  give you a pseudo-graphical answer, not numerical

2) date +%j   ;  date +%U  ;  date +%u  give you answer n numerical form. Be carefull with date +%U - number of weeks start with 00, not traditional 01

jeesshnasree
Starfighter Starfighter
Starfighter
  • 4,905 Views

Hi @Alexandre ,

 

Thank you for your valuable information .

 

 

Regards ,

Jeesshnasree

0 Kudos
Join the discussion
You must log in to join this conversation.