Sponsored Content
Top Forums Shell Programming and Scripting Converting Date from YYYYMMDD to DD-MON-YYYY Post 302582122 by vivek d r on Thursday 15th of December 2011 02:45:30 AM
Old 12-15-2011
here is your code.. :-)

Code:
date=20111214
len=${#date}
echo $len
dat=${date:6:8}
yr=${date:0:4}
mon=${date:4:6}
mon=${mon:0:2}
var1="jan"
var2="feb"
var3="mar"
var4="apr"
var5="may"
var6="jun"
var7="jul"
var8="aug"
var9="sep"
var10="oct"
var11="nov"
var12="dec"
val=$( eval eval echo \$var$mon )
echo "$dat-$val-$yr"

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to convert the string YYYYMMDD into YYYY.MM.DD

how to convert the string YYYYMMDD into YYYY.MM.DD Please advice (1 Reply)
Discussion started by: spatra
1 Replies

2. Shell Programming and Scripting

Change Date from dd-mmm-yyyy to mm/dd/yyyy

I want to change a date from format dd-mmm-yyyy to mm/dd/yyyy. Is there a way to do this with sed or do you have to write a case statement to convert JAN to 01? Thanks (9 Replies)
Discussion started by: stringzz
9 Replies

3. Shell Programming and Scripting

converting the date field from dd/mm/yyyy to yyyy/mm/dd

How to convert the date field from dd/mm/yyyy to yyyy/mm/dd in unix my script will generate text file which have two fields one is date and another is name of the server for example this is sample date which I have to sort based on older to newer date the problem is when I found out sort will... (4 Replies)
Discussion started by: pareshan
4 Replies

4. UNIX for Dummies Questions & Answers

Format date from MM/DD/YYYY to YYYYMMDD

I have a file with some date columns in MM/DD/YYYY format: SMPBR|DUP-DO NOT USE|NEW YORK||16105|BA5270715|6/6/2007 |MWERNER|109||||JOHN||SMITH|MD|72211118||||||74559|21 WILMINGTON RD||D|11/6/2003|SL# MD CONTACT-LIZ RICHARDS|||0|Y|N||1411458| And I want to convert the date format to: ... (5 Replies)
Discussion started by: ChicagoBlues
5 Replies

5. Shell Programming and Scripting

convert date format YYYYMMDD to MM/DD/YYYY

In my shell script i have a variable which stores date in the format of YYYYMMDD. Is there any way to format this value to MM/DD/YYYY. Thanks. (8 Replies)
Discussion started by: nasirgondal
8 Replies

6. Shell Programming and Scripting

PERL String to Date (Custom format yyyymmdd to dd-mon-yyyy)

Hi All, I am learning PERL for one of the projects, and in one of these scripts, I read a flat text file and print in the terminal. The problem is, the text file has a date field. The format is yyyymmdd. I need to display this as dd-mon-yyyy. Any ideas to do this? Thanks a lot for the... (9 Replies)
Discussion started by: guruparan18
9 Replies

7. Shell Programming and Scripting

change date format from yyyy/mm/dd to dd/mm/yyyy

(Attention: Green PHP newbie !) I have an online inquiry form, delivering a date in the form yyyy/mm/dd to my feedback form. If the content passes several checks, the form sends an e-mail to me. All works fine. I just would like to receive the date in the form dd/mm/yyyy. I tried with some code,... (6 Replies)
Discussion started by: keyboarder
6 Replies

8. Shell Programming and Scripting

Converting date DD MM YYYY to DD MON YYYY

Hello, I am writing a script that parses different logs and produces one. In the source files, the date is in DD MM YYYY HH24:MI:SS format. In the output, it should be in DD MON YYY HH24:MI:SS (ie 25 Jan 2010 16:10:10) To extract the dates, I am using shell substrings, i.e.: read line ... (4 Replies)
Discussion started by: Adamm
4 Replies

9. Shell Programming and Scripting

Date conversion help from dd/mm/yyyy to dd/Mon/yyyy i.e. 28/10/2012 to 28/Oct/2012

Hi I have a problem with Date format in my code. 1st I am trying to convert today's date to yesterday's using YESTERDAY3=`perl -e '@y=localtime(time()-86400); printf "%04d/%02d/%02d",$y+1900,$y+1,$y;$y;'` And once it is done I am trying to using the yesterday date in a grep command to... (3 Replies)
Discussion started by: nithinankam
3 Replies

10. Programming

Date format change from mm/dd/yyyy to yyyymmdd in comma seperate line in perl

Hi All, I have line ,A,FDRM0002,12/21/2017,,0.961751583,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, it contains date in mm/dd/yyyy format i want to change this to yyyymmdd format using perl. Use code tags, thanks. (8 Replies)
Discussion started by: vishal0746
8 Replies
DateTime::Locale::kl_GL(3)				User Contributed Perl Documentation				DateTime::Locale::kl_GL(3)

NAME
DateTime::Locale::kl_GL SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'kl_GL' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Kalaallisut Greenland. DATA
This locale inherits from the DateTime::Locale::kl locale. It contains the following data. Days Wide (format) ataasinngorneq marlunngorneq pingasunngorneq sisamanngorneq tallimanngorneq arfininngorneq sabaat Abbreviated (format) ata mar pin sis tal arf sab Narrow (format) 2 3 4 5 6 7 1 Wide (stand-alone) ataasinngorneq marlunngorneq pingasunngorneq sisamanngorneq tallimanngorneq arfininngorneq sabaat Abbreviated (stand-alone) ata mar pin sis tal arf sab Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) januari februari martsi aprili maji juni juli augustusi septemberi oktoberi novemberi decemberi Abbreviated (format) jan feb mar apr maj jun jul aug sep okt nov dec Narrow (format) 1 2 3 4 5 6 7 8 9 10 11 12 Wide (stand-alone) januari februari martsi aprili maji juni juli augustusi septemberi oktoberi novemberi decemberi Abbreviated (stand-alone) jan feb mar apr maj jun jul aug sep okt nov dec Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Quarters Wide (format) Q1 Q2 Q3 Q4 Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) Q1 Q2 Q3 Q4 Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BCE CE Abbreviated BCE CE Narrow BCE CE Date Formats Full 2008-02-05T18:30:30 = marlunngorneq 05 februari 2008 1995-12-22T09:05:02 = tallimanngorneq 22 decemberi 1995 -0010-09-15T04:44:23 = arfininngorneq 15 septemberi -10 Long 2008-02-05T18:30:30 = 05 februari 2008 1995-12-22T09:05:02 = 22 decemberi 1995 -0010-09-15T04:44:23 = 15 septemberi -10 Medium 2008-02-05T18:30:30 = feb 05, 2008 1995-12-22T09:05:02 = dec 22, 1995 -0010-09-15T04:44:23 = sep 15, -10 Short 2008-02-05T18:30:30 = 05/02/08 1995-12-22T09:05:02 = 22/12/95 -0010-09-15T04:44:23 = 15/09/-10 Default 2008-02-05T18:30:30 = feb 05, 2008 1995-12-22T09:05:02 = dec 22, 1995 -0010-09-15T04:44:23 = sep 15, -10 Time Formats Full 2008-02-05T18:30:30 = 6:30:30 PM UTC 1995-12-22T09:05:02 = 9:05:02 AM UTC -0010-09-15T04:44:23 = 4:44:23 AM UTC Long 2008-02-05T18:30:30 = 6:30:30 PM UTC 1995-12-22T09:05:02 = 9:05:02 AM UTC -0010-09-15T04:44:23 = 4:44:23 AM UTC Medium 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM Short 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Default 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM Datetime Formats Full 2008-02-05T18:30:30 = marlunngorneq 05 februari 2008 6:30:30 PM UTC 1995-12-22T09:05:02 = tallimanngorneq 22 decemberi 1995 9:05:02 AM UTC -0010-09-15T04:44:23 = arfininngorneq 15 septemberi -10 4:44:23 AM UTC Long 2008-02-05T18:30:30 = 05 februari 2008 6:30:30 PM UTC 1995-12-22T09:05:02 = 22 decemberi 1995 9:05:02 AM UTC -0010-09-15T04:44:23 = 15 septemberi -10 4:44:23 AM UTC Medium 2008-02-05T18:30:30 = feb 05, 2008 6:30:30 PM 1995-12-22T09:05:02 = dec 22, 1995 9:05:02 AM -0010-09-15T04:44:23 = sep 15, -10 4:44:23 AM Short 2008-02-05T18:30:30 = 05/02/08 6:30 PM 1995-12-22T09:05:02 = 22/12/95 9:05 AM -0010-09-15T04:44:23 = 15/09/-10 4:44 AM Default 2008-02-05T18:30:30 = feb 05, 2008 6:30:30 PM 1995-12-22T09:05:02 = dec 22, 1995 9:05:02 AM -0010-09-15T04:44:23 = sep 15, -10 4:44:23 AM Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 mar 1995-12-22T09:05:02 = 22 tal -0010-09-15T04:44:23 = 15 arf Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = mar, 2-5 1995-12-22T09:05:02 = tal, 12-22 -0010-09-15T04:44:23 = arf, 9-15 MMdd (dd/MM) 2008-02-05T18:30:30 = 05/02 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/09 MMM (LLL) 2008-02-05T18:30:30 = feb 1995-12-22T09:05:02 = dec -0010-09-15T04:44:23 = sep MMMd (MMM d) 2008-02-05T18:30:30 = feb 5 1995-12-22T09:05:02 = dec 22 -0010-09-15T04:44:23 = sep 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = mar feb 5 1995-12-22T09:05:02 = tal dec 22 -0010-09-15T04:44:23 = arf sep 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = februari 5 1995-12-22T09:05:02 = decemberi 22 -0010-09-15T04:44:23 = septemberi 15 MMMMdd (dd MMMM) 2008-02-05T18:30:30 = 05 februari 1995-12-22T09:05:02 = 22 decemberi -0010-09-15T04:44:23 = 15 septemberi MMMMEd (E MMMM d) 2008-02-05T18:30:30 = mar februari 5 1995-12-22T09:05:02 = tal decemberi 22 -0010-09-15T04:44:23 = arf septemberi 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = mar, 2008-2-5 1995-12-22T09:05:02 = tal, 1995-12-22 -0010-09-15T04:44:23 = arf, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 feb 1995-12-22T09:05:02 = 1995 dec -0010-09-15T04:44:23 = -10 sep yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = mar, 2008 feb 5 1995-12-22T09:05:02 = tal, 1995 dec 22 -0010-09-15T04:44:23 = arf, -10 sep 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 februari 1995-12-22T09:05:02 = 1995 decemberi -0010-09-15T04:44:23 = -10 septemberi yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyMM (MM/yy) 2008-02-05T18:30:30 = 02/08 1995-12-22T09:05:02 = 12/95 -0010-09-15T04:44:23 = 09/-10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = februari 2008 1995-12-22T09:05:02 = decemberi 1995 -0010-09-15T04:44:23 = septemberi -10 Miscellaneous Prefers 24 hour time? No Local first day of the week sabaat SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::kl_GL(3)
All times are GMT -4. The time now is 12:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy