Home » Infrastructure » Unix » is it possible
is it possible [message #97267] Thu, 14 February 2002 09:12 Go to next message
Messages: 255
Registered: April 2000
Senior Member

How to convert a numeric month into 3 char month in unix or C language or C++.
for example:
if i get a input = 02
how to convert into FEB by reading from calendar.

Appreciate any help
Re: is it possible [message #97268 is a reply to message #97267] Thu, 14 February 2002 18:30 Go to previous message
Messages: 5
Registered: February 2002
Junior Member
say you have int i=2 from the input.

If you have an array of months such as

static char *months[[]] = {
"JAN", "FEB", "MAR", .... , "NOV", "DEC"

Then, all you have to do with refer months[[i-1]].

Of course, you'll have to check the range so that the array index stays between 0 and 11.

You may add 'const' to the array depending on what you want to do.
Previous Topic: Re: Error connecting to db : Oracle 8.1.6
Next Topic: Re: ftp script
Goto Forum:

Current Time: Sun Sep 27 20:40:12 CDT 2020