Home » Infrastructure » Unix » UNIX
UNIX [message #304934] Fri, 07 March 2008 04:17 Go to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Hi all,
I have one doubt in UNIX. I am new to working on UNIX platform.

I have sysdate as " 01-Mar-08". I want to see the previous day date "29-feb-08".


and one more :
[code]
i have date format as "YYYYMMDD" .Now i want to change the format as "DDMMYYYY"
[/code/

what are the commands for this Issues .please let me know...

Thanks in advance.....

Re: UNIX [message #304942 is a reply to message #304934] Fri, 07 March 2008 04:49 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Did you read TO_CHAR function?

Regards
Michel
Re: UNIX [message #304951 is a reply to message #304942] Fri, 07 March 2008 05:19 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Michel,

I ORACLE I have done. But I need the command in UNIX. Please tell me.. And one more

using the following command I am getting the O/P as:
date '+%y:%m:%d' | awk -F":" '{printf"20%2d%2d%2d\n",$1,$2,($3-1)}' | sed 's/ /0/g'
 O/P :  20080306

Now i need yhe output as using this command only

O/P: 2008-Mar-06

Please give me the solution for these two issues

Thank u.
Re: UNIX [message #304965 is a reply to message #304934] Fri, 07 March 2008 06:06 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
date '+%y:%m:%d' | awk -F":" '{printf"20%2d%2d%2d\n",$1,$2,($3-1)}' | sed 's/ /0/g' | sed 's/03/-Mar-/g'
Re: UNIX [message #304967 is a reply to message #304951] Fri, 07 March 2008 06:08 Go to previous message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
So this is NOT an Oracle question.

Regards
Michel
Previous Topic: Looping problem
Next Topic: how to setup bashprofile for multiple oracle homes
Goto Forum:
  


Current Time: Thu Nov 21 23:10:49 CST 2024