Script to find out first day of our calender

 
Thread Tools Search this Thread
Operating Systems Linux Fedora Script to find out first day of our calender
# 1  
Old 03-11-2010
Script to find out first day of our calender

I try to find the first day of our calender. So I used this script ...

echo -n "The week of the date 01jan0001 : "
echo -n `date -d 00010101 +%A`
echo


But its shows error

bash-3.1$ sh first_day.shThe week of the date 01jan0001 : date: invalid date `00010101'
# 2  
Old 03-11-2010
Yo uhave a lot of assumptions that are correct.

However, try
Code:
cal 1

Our current calendar - the gragorian - started at different time in different countries - starting in October 1582.

the calendar in effect in the year "1" - which there was not one of on the calendar in effect at the time - was the the progenitor of the Julian calendar.

Gregorian calendar - Wikipedia, the free encyclopedia
# 3  
Old 03-11-2010
I tried the same script in another system fedora 11, it works... but mine is Slackware...
shows the following errors...

echo -n "The week of the date 01jan0001 : "
echo -n `date -d 00010101 +%A`
echo

bash-3.1$ sh first_day.sh
The week of the date 01jan0001 : date: invalid date `00010101'

bash-3.1$

Anyway How to find out which day of the week was the beginning of our calender?
If it is Saturday, I just wanna display "Saturday"


Thanking you.Smilie
# 4  
Old 03-12-2010
Quote:
I tried the same script in another system fedora 11, it works..
Out of curiosity, I tested it on Fedora 12. The output was:
Quote:
Mon Jan 1 00:00:00 LMT 0001
which was interesting. I have no clue what LMT 0001 means. Does not show up in the coreutils date source code.

The reality is that any output from the date command is meaningless. There was no concept of calendar months or even calendar years as we know them today in that era.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find the date of previous day in shell script?

Hi Experts, i am using the below code get the date of previous day. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest When i execute the code i am getting output as: 20130715 What i am trying here is, based on the date passed i am fetching previus day's... (0 Replies)
Discussion started by: learner24
0 Replies

2. HP-UX

Find Day of Week

In HP-UX the date command does not have the "-d" switch like some other *nixes do. I'm working a simple script to tell me, given the day, month and year what day of the week that falls on. Assuming valid day, month and year input (I'd perform quality checks on the input separately, but not... (5 Replies)
Discussion started by: rwuerth
5 Replies

3. Shell Programming and Scripting

Script to check if last modified day is previous day

Hi, I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it. For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies

4. Shell Programming and Scripting

Find files of particular day

Hi, I need to find all files of particular day lets say for 2nd august in below. -rw-r--r-- 1 skl eusdc 8168 Aug 5 19:31 aabc123.txt -rw-r--r-- 1 skl eusdc 4251 Aug 5 19:31 aabc124.txt -rw-r--r-- 1 skl eusdc 4252 Aug 6 19:31 aabc125.txt -rw-r--r-- ... (15 Replies)
Discussion started by: sachinkl
15 Replies

5. Shell Programming and Scripting

Find out the day in Bash Shell script

Hello All, I need a bash shell script to find out a day from the date.For example we give the date(20100227/YYYYMMDD) then we get the day 'Saturday'. Thanks in advance, Satheesh (5 Replies)
Discussion started by: satheesh4093
5 Replies

6. Shell Programming and Scripting

script to find filenames with latest version and for all seq. numbers in a day

Hi, We have a requirement to find the set of filenames from the group of files in a specified folder based on (i) version number (ii) sequence number such that, for any given sequence number in a day only the latest version filenames have to indentified. Below is the format of... (4 Replies)
Discussion started by: Deepakbabu
4 Replies

7. HP-UX

To find day out of date in HP-unix

Dear Frends, Could you please help me with the command or option by which I can find day where the input is date(can be of future or past). I do have for linux, However it is not working @ hp unix. Please help. Regards Rahul (4 Replies)
Discussion started by: Rahul chitriv
4 Replies

8. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

9. UNIX for Dummies Questions & Answers

find -mtime off by one day?

If I use the find command to find files older than n days I have to enter find . -mtime +(n-1). I tried this on a Solaris 9 system and also Linux. Is this something that all Unix veterans know about (I'm new to Unix)? If so, maybe my man pages need to be updated (how to do this?). :confused: (4 Replies)
Discussion started by: ceanntrean
4 Replies

10. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies
Login or Register to Ask a Question