Problem with o/p of date command.......


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with o/p of date command.......
# 1  
Old 09-10-2008
Problem with o/p of date command.......

Hii.. Everyone :

I have 15 Sun Servers with Solaris-10, Now on some of the servers when
I execuit the command "date" I get following o/p :

# date
Wed Sep 10 22:29:37 IST 2008

And on some of Servers I am getting :

# date
Wednesday, September 10, 2008 10:23:47 PM IST

Kindly see the difference in o/p.In second o/p I am getting full name
(Wednesday & September).But I want all servers to give o/p as the first one.
So, Kindly Help me.........
I am having the root passward.

Thanks in Advance..........
# 2  
Old 09-10-2008
From man date:
Code:
     Specifications of native language translations of month  and
     weekday  names  are  supported.  The month and weekday names
     used for a language are based on the locale specified by the
     environment variable LC_TIME. See environ(5).

You can force the date command to display in a specific format:
From man date:
Code:
     example% date '+DATE: %m/%d/%y%nTIME:%H:%M:%S'
     generates as output
     DATE: 08/01/76
     TIME: 14:45:05

Play around with the 'date' options until you get the format that you like, or fix your locale inconsistencies.
# 3  
Old 09-10-2008
For locale inconsistencies, see if LC_ALL=C date helps.
# 4  
Old 09-10-2008
Hiii era...

I am getting following o/p with locale command :

# locale
LANG=
LC_CTYPE=en_US.ISO8859-1
LC_NUMERIC=en_US.ISO8859-15
LC_TIME=en_US.ISO8859-15
LC_COLLATE=en_US.ISO8859-15
LC_MONETARY=en_US.ISO8859-15
LC_MESSAGES=C
LC_ALL=


But I want settings as follow :

# locale
LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=


So, how can I change the settings of first o/p, as of the second one.Because with these settings I am getting desired results with date command.
Kindly Suggest......
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

current date command runs well awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat subtract 30 days fails awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies

2. Linux

Problem with date command

Hello, Can anyone have an idea what is wrong with this code: $ YESTERDAY=$(date -d "yesterday" '+%Y-%m-%d 07:00:00') $ echo $YESTERDAY 2016-12-26 07:00:00 $ date -d '($YESTERDAY)' +"%s000" 1482793200000 1482793200000 is not correct, it should be: 1482732000000 Result when... (2 Replies)
Discussion started by: chrz
2 Replies

3. HP-UX

HP/UX command to pull file name/date based on date

HI, Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
Discussion started by: lnemitz
2 Replies

4. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

5. Shell Programming and Scripting

Problem with the date command

i cant seem to figure out why this isn't working: root@jlota-Box1:~# date "%b %d %H:%M %Y" --date "Feb 08 00:57 2014 EDT +1 min" date: invalid date ‘Feb 08 00:57 2014 EDT +1 min' OS: Linux (ubuntu,redhat,sunos) (4 Replies)
Discussion started by: SkySmart
4 Replies

6. Shell Programming and Scripting

Cron Job - date command problem

Hi I have one problem with cron job in Control Panel. I have a log file that is created once a day on another server and I need to transfer it in an exact time to my server so I wrote the cron job for it BUT the problem is in the date command: /filelog-`date +%Y-%m-%d`.tar.gz; The file... (1 Reply)
Discussion started by: bobo_balde
1 Replies

7. Shell Programming and Scripting

how to obtain date and day of the week from `date` command

Hi, does anybody know how to format `date` command correctly to return the day of the week? Thanks -A I work in ksh.... (1 Reply)
Discussion started by: aoussenko
1 Replies

8. Shell Programming and Scripting

want to get previous date from date command in ksh

I want to get previous date from date command. I am using ksh shell. Exmp: today is 2008.09.04 I want the result : 2008.09.03 Please help. Thanks in advance. (4 Replies)
Discussion started by: rinku
4 Replies

9. Shell Programming and Scripting

problem in making file name from date command

Dear all I am bit new to programming. I have to redirect the output to a file which will be in the following format man ls> date +"hup-%m%d%y-%H%M" --------> this will show me the month,day,year,hours and minute in a file name whose name start from "hup-" kindly any correct my syntax (2 Replies)
Discussion started by: girish.batra
2 Replies

10. UNIX for Dummies Questions & Answers

Problem with date command

Hi, I wish to display date say 25th Jan, 2008 in format '25-1-2008' i.e. month should be displayed as '1' and not '01'. I wish that 0 should not be displayed in month. Thanks Rochit (4 Replies)
Discussion started by: rochitsharma
4 Replies
Login or Register to Ask a Question