How Can we change the Date format from Variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How Can we change the Date format from Variable
# 1  
Old 05-02-2008
How Can we change the Date format from Variable

curr_date=yyyy-mm-dd
1.we want get month from the above date
2.Change the format into yyyymmdd
# 2  
Old 05-02-2008
curr_date=yyyy-mm-dd
echo $curr_date | cut -d- -f2
echo $curr_date | tr -d -

-ilan
PSSmilielease search in the forum before posting any question; most of the times (these kind of solutions) will be available already!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Change just the date format

need some more help please i have a large file and i want to change just the date format with awk or sed from this yyyy-mm-dd 2016-04-15 8.30 2016-04-15 7.30 2016-04-13 7.30 2016-04-11 8.30 2016-04-11 7.30 2016-04-08 8.30 2016-04-08 7.30 2016-04-06... (5 Replies)
Discussion started by: bob123
5 Replies

2. UNIX for Dummies Questions & Answers

Change Date from one format to other

Hi I wish to change date from one format to another in unix. eg: INPUT DATE: 2013159 (YEAR & NUMBER OF DAY) OUTPUT DATE required: 20130608 (YYYYMMDD) how to do it ? Thanks in advance. (6 Replies)
Discussion started by: dashing201
6 Replies

3. Shell Programming and Scripting

Date format change

Dear Friends, Need your help once again, I have a variable ( e.g. ${i}) whoch has date in MM/DD/YYYY (E.g. 12/31/2011) format. I want to change it to DD/MM/YYYY (e.g. 31/12/2011) format. Request you to guide me as we are unable to do the same. Thanks in advance Anu. (1 Reply)
Discussion started by: anushree.a
1 Replies

4. Shell Programming and Scripting

How to change the date format

Hi Guys, Can someone help me on how to change the date format using sed or any unix command to give my desired output as shown below. INPUT FILE: 69372,200,20100122T17:56:02,2 53329,500,20100121T11:50:07,2 48865,100,20100114T16:08:16,2 11719,200,20100108T13:32:20,2 DESIRED... (2 Replies)
Discussion started by: pinpe
2 Replies

5. Shell Programming and Scripting

Change Date Format

Hi Guys, I had a scenario like this.. It seems very silly...dont think it as a home work question.....:) i tried it many ways but i didn't achieve this... start_date=May122011 here i want to change the start_date in to 20110512 start_date=20110512 tell me how can we achive... (5 Replies)
Discussion started by: apple2685
5 Replies

6. Shell Programming and Scripting

Date Format Change

Hi, Please can I have some command to get yesterday in YYMMDD format? This will be used in ksh Thanks, (2 Replies)
Discussion started by: smalya
2 Replies

7. Shell Programming and Scripting

Date Format Change

Hi I have a date format in a variable as Mon Jan 11 03:35:59 2010. how do i change it to YYYYMMDD format (3 Replies)
Discussion started by: keerthan
3 Replies

8. Solaris

change date format

dear members, ls -l drwxr-xr-x 40 root sys 1024 Jul 11 22:19 usr drwxr-xr-x 43 root sys 1024 Feb 1 2009 var i am using solaris 10 is that possibe to do drwxr-xr-x 40 root sys 1024 25-08-2009 22:19 usr drwxr-xr-x 43 root sys ... (4 Replies)
Discussion started by: hosney00ux
4 Replies

9. Shell Programming and Scripting

Change of date format

I want to chnage the date format from the file format like below to WT;T15D;0000007208;;20080401;3;0;0;3;;B;ZZZZZZ; WT;T25D;0000007208;;20080401;6;0;0;6;;B;ZZZZZZ; WT;T5D;0000007208;;20080401;123;0;0;123;;B;ZZZZZZ; to WT;T15D;0000007208;;04/01/200804;3;0;0;3;;B;ZZZZZZ;... (2 Replies)
Discussion started by: svenkatareddy
2 Replies

10. UNIX for Advanced & Expert Users

Change date format

I know the command date +"%Y%m%d" can change today's date to digit format as below . $date +"%Y%m%d" 20071217 it works fine . now I want to do it back . If I have a file like below, (in the file , there are three lines, and each line have ; sign , after the ; sign is the date ) , I... (4 Replies)
Discussion started by: ust
4 Replies
Login or Register to Ask a Question