Sponsored Content
Top Forums Shell Programming and Scripting Converting Month into Integer Post 302662415 by alister on Tuesday 26th of June 2012 01:44:54 PM
Old 06-26-2012
I would suggest using a simple case statement. It's not especially clever, but it's tailor-made for this scenario.

Code:
case $month_name in
    Jan) month_number=1;;
    Feb) month_number=2;;
    Mar) month_number=3;;
esac

Regards,
Alister
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command for converting string to integer

Hi ... I am trying to calculate the time needed for a command to execute.. but the resulting value is getting as string.. so i am not able to use "expr " command.. please help me to convert the value to integer so that i can proceed with my script.. Regards esham (1 Reply)
Discussion started by: esham
1 Replies

2. Shell Programming and Scripting

Converting a decimal into integer

Hi all, I'm trying to convert a decimal number into an integer number; I'm doing this: n=`echo |awk '{ print "'"$mem"'"*10}'` where the variable mem is equal to 3.7 I'd like to obtain 37, but the expression above gives me 30. Help please!!!! thx a lot (4 Replies)
Discussion started by: idro
4 Replies

3. UNIX for Dummies Questions & Answers

Converting a String variable into Integer

Hi, I am passing a variable to a unix function. However when I try to assign the value to another variable like typeset -i I_CACHE_VAL=$2 Is this because of String to Integer conversion? I get an error. Please help me with thsi. Thanks (2 Replies)
Discussion started by: neeto
2 Replies

4. Shell Programming and Scripting

Converting integer to String

Hi everyone, I would like to know how to convert an integer to a string. for instance if i=1 i would like to creat a variable called constant1. i want to do this in a for loop so for each value of i, i create a new variable such as constant2, constant3,... and so on. for i in 1 2 3 do ... (1 Reply)
Discussion started by: ROOZ
1 Replies

5. Shell Programming and Scripting

Converting decimal to integer

The shell mentioned below will show a warning if the page takes more than 6 seconds to load. The problem is that myduration variable is not an integer. How do I convert it to integer? myduration=$(curl http://192.168.50.1/mantisbt/view.php?id=1 -w %{time_total}) > /dev/null ; ] && echo... (3 Replies)
Discussion started by: shantanuo
3 Replies

6. Shell Programming and Scripting

Converting date +%j into integer

Dear community, i got a problem to get "date +%j" as the right value. Today is the 10th day of the year. #./script.sh 2 #!/bin/bash/ Var1=$(date +%j) Var2=$1 let result=$Var1+$Var2 echo $Var1 plus $Var2 equals $result The output of the script is: 010 plus 2 equals 10... (9 Replies)
Discussion started by: OskarHF
9 Replies

7. Shell Programming and Scripting

Converting string to integer

I have a function that is supposed to check for user processes and wait for 0 count before exiting the function. I am sure I have more than one issue in my code, but the stumbling block right now is that I am trying to convert the value of my variable from a string to integer. process_count... (10 Replies)
Discussion started by: MIA651
10 Replies

8. Shell Programming and Scripting

Converting String To Integer/Float (weird case)

Hi guys, I'm new here. I have a problem at work. One of our scripts was eventually having a bug and only detected recently. Here's the issue and background: Bash Script which calls AWK script Awk script returns a string as per below (example):var1='00000-123'So, when we convert it, the... (18 Replies)
Discussion started by: sekfarok
18 Replies

9. Shell Programming and Scripting

Converting time format as Integer to seconds

Hello, How can we convert date like format 20181004171050 in seconds ? I can able to convert till date but failing for HHMMSS. date -d "20181004" "+%s" output as 1538596800 . But when i add hhmmss it is failing date -d "20181004172000" "+%s" result Invalid date Kindly guide. Regards (16 Replies)
Discussion started by: sadique.manzar
16 Replies

10. UNIX for Beginners Questions & Answers

Replace integer string in a variable based on month?

Hi Folks - Linux Version = Linux 2.6.39-400.128.17.el5uek x86_64 I have a process that determines the start and end load periods for an Oracle data load process. The variables used are as follows follows: They are populated like such: However, the load requires the month to be the... (11 Replies)
Discussion started by: SIMMS7400
11 Replies
DateTime::Locale::af_ZA(3)				User Contributed Perl Documentation				DateTime::Locale::af_ZA(3)

NAME
DateTime::Locale::af_ZA SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'af_ZA' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Afrikaans South Africa. DATA
This locale inherits from the DateTime::Locale::af locale. It contains the following data. Days Wide (format) Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag Sondag Abbreviated (format) Ma Di Wo Do Vr Sa So Narrow (format) 2 3 4 5 6 7 1 Wide (stand-alone) Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag Sondag Abbreviated (stand-alone) Ma Di Wo Do Vr Sa So Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) Januarie Februarie Maart April Mei Junie Julie Augustus September Oktober November Desember Abbreviated (format) Jan Feb Mar Apr Mei Jun Jul Aug Sep Okt Nov Des Narrow (format) 1 2 3 4 5 6 7 8 9 10 11 12 Wide (stand-alone) Januarie Februarie Maart April Mei Junie Julie Augustus September Oktober November Desember Abbreviated (stand-alone) Jan Feb Mar Apr Mei Jun Jul Aug Sep Okt Nov Des Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Quarters Wide (format) 1ste kwartaal 2de kwartaal 3de kwartaal 4de kwartaal Abbreviated (format) K1 K2 K3 K4 Narrow (format) 1 2 3 4 Wide (stand-alone) 1ste kwartaal 2de kwartaal 3de kwartaal 4de kwartaal Abbreviated (stand-alone) K1 K2 K3 K4 Narrow (stand-alone) 1 2 3 4 Eras Wide voor Christus na Christus Abbreviated v.C. n.C. Narrow v.C. n.C. Date Formats Full 2008-02-05T18:30:30 = Dinsdag 05 Februarie 2008 1995-12-22T09:05:02 = Vrydag 22 Desember 1995 -0010-09-15T04:44:23 = Saterdag 15 September -10 Long 2008-02-05T18:30:30 = 05 Februarie 2008 1995-12-22T09:05:02 = 22 Desember 1995 -0010-09-15T04:44:23 = 15 September -10 Medium 2008-02-05T18:30:30 = 05 Feb 2008 1995-12-22T09:05:02 = 22 Des 1995 -0010-09-15T04:44:23 = 15 Sep -10 Short 2008-02-05T18:30:30 = 2008/02/05 1995-12-22T09:05:02 = 1995/12/22 -0010-09-15T04:44:23 = -010/09/15 Default 2008-02-05T18:30:30 = 05 Feb 2008 1995-12-22T09:05:02 = 22 Des 1995 -0010-09-15T04:44:23 = 15 Sep -10 Time Formats Full 2008-02-05T18:30:30 = 6:30:30 nm. UTC 1995-12-22T09:05:02 = 9:05:02 vm. UTC -0010-09-15T04:44:23 = 4:44:23 vm. UTC Long 2008-02-05T18:30:30 = 6:30:30 nm. UTC 1995-12-22T09:05:02 = 9:05:02 vm. UTC -0010-09-15T04:44:23 = 4:44:23 vm. UTC Medium 2008-02-05T18:30:30 = 6:30:30 nm. 1995-12-22T09:05:02 = 9:05:02 vm. -0010-09-15T04:44:23 = 4:44:23 vm. Short 2008-02-05T18:30:30 = 6:30 nm. 1995-12-22T09:05:02 = 9:05 vm. -0010-09-15T04:44:23 = 4:44 vm. Default 2008-02-05T18:30:30 = 6:30:30 nm. 1995-12-22T09:05:02 = 9:05:02 vm. -0010-09-15T04:44:23 = 4:44:23 vm. Datetime Formats Full 2008-02-05T18:30:30 = Dinsdag 05 Februarie 2008 6:30:30 nm. UTC 1995-12-22T09:05:02 = Vrydag 22 Desember 1995 9:05:02 vm. UTC -0010-09-15T04:44:23 = Saterdag 15 September -10 4:44:23 vm. UTC Long 2008-02-05T18:30:30 = 05 Februarie 2008 6:30:30 nm. UTC 1995-12-22T09:05:02 = 22 Desember 1995 9:05:02 vm. UTC -0010-09-15T04:44:23 = 15 September -10 4:44:23 vm. UTC Medium 2008-02-05T18:30:30 = 05 Feb 2008 6:30:30 nm. 1995-12-22T09:05:02 = 22 Des 1995 9:05:02 vm. -0010-09-15T04:44:23 = 15 Sep -10 4:44:23 vm. Short 2008-02-05T18:30:30 = 2008/02/05 6:30 nm. 1995-12-22T09:05:02 = 1995/12/22 9:05 vm. -0010-09-15T04:44:23 = -010/09/15 4:44 vm. Default 2008-02-05T18:30:30 = 05 Feb 2008 6:30:30 nm. 1995-12-22T09:05:02 = 22 Des 1995 9:05:02 vm. -0010-09-15T04:44:23 = 15 Sep -10 4:44:23 vm. 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 Di 1995-12-22T09:05:02 = 22 Vr -0010-09-15T04:44:23 = 15 Sa 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 nm. 1995-12-22T09:05:02 = 9:05 vm. -0010-09-15T04:44:23 = 4:44 vm. 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 nm. 1995-12-22T09:05:02 = 9:05:02 vm. -0010-09-15T04:44:23 = 4:44:23 vm. 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 = Di, 2-5 1995-12-22T09:05:02 = Vr, 12-22 -0010-09-15T04:44:23 = Sa, 9-15 MMdd (MM/dd) 2008-02-05T18:30:30 = 02/05 1995-12-22T09:05:02 = 12/22 -0010-09-15T04:44:23 = 09/15 MMM (LLL) 2008-02-05T18:30:30 = Feb 1995-12-22T09:05:02 = Des -0010-09-15T04:44:23 = Sep MMMd (MMM d) 2008-02-05T18:30:30 = Feb 5 1995-12-22T09:05:02 = Des 22 -0010-09-15T04:44:23 = Sep 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = Di Feb 5 1995-12-22T09:05:02 = Vr Des 22 -0010-09-15T04:44:23 = Sa Sep 15 MMMMd (d MMMM) 2008-02-05T18:30:30 = 5 Februarie 1995-12-22T09:05:02 = 22 Desember -0010-09-15T04:44:23 = 15 September MMMMdd (dd MMMM) 2008-02-05T18:30:30 = 05 Februarie 1995-12-22T09:05:02 = 22 Desember -0010-09-15T04:44:23 = 15 September MMMMEd (E MMMM d) 2008-02-05T18:30:30 = Di Februarie 5 1995-12-22T09:05:02 = Vr Desember 22 -0010-09-15T04:44:23 = Sa September 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 = Di, 2008-2-5 1995-12-22T09:05:02 = Vr, 1995-12-22 -0010-09-15T04:44:23 = Sa, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 Feb 1995-12-22T09:05:02 = 1995 Des -0010-09-15T04:44:23 = -10 Sep yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = Di, 2008 Feb 5 1995-12-22T09:05:02 = Vr, 1995 Des 22 -0010-09-15T04:44:23 = Sa, -10 Sep 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 Februarie 1995-12-22T09:05:02 = 1995 Desember -0010-09-15T04:44:23 = -10 September 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 K1 1995-12-22T09:05:02 = 1995 K4 -0010-09-15T04:44:23 = -10 K3 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMM (yyyy/MM) 2008-02-05T18:30:30 = 2008/02 1995-12-22T09:05:02 = 1995/12 -0010-09-15T04:44:23 = -010/09 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = Februarie 2008 1995-12-22T09:05:02 = Desember 1995 -0010-09-15T04:44:23 = September -10 Miscellaneous Prefers 24 hour time? No Local first day of the week Maandag 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.16.3 2014-06-10 DateTime::Locale::af_ZA(3)
All times are GMT -4. The time now is 09:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy