problem in storing date and time from a GSM module.

wrote a program to read get date from a GSM network. the program works fine , BUT i am unable to store the information for furthur processing.

OK. Thanks for letting us know. Good luck.

wrote a program

That you didn't share...

BUT i am unable to store the information for furthur processing.

How are you getting the data? One character at a time? You seriously mean to tell us you can't figure out how to store characters?

the data is in the form yy/mm/dd.hourhour/minmin/secsec new to arduino :confused:

Hint: We can't see your code. (and use code tags)

// i am not using a GSM shield. i read the command response using Hyperterminal and not the serial moniter. cannot read using serial moniter because i dont know the data type of reply
void setup() {


Serial.begin(9600);


Serial.print("AT+CLTS=1;\r\n" );// sends the clts command to the gsm module, clts returns local time                            stamp
delay(500);
Serial.print("AT+CCLK?;\r\n" ); // sets device clock


}

void loop() 
{
}

You are sending commands to something connected to the serial port. You are not reading anything. Therefore, there is nothing to store for later parsing.

It appears that you actually have two things, a GSM module and a PC connected to the one hardware serial port. Beyond confirming that the GSM might be working, that is NOT going to work. The sooner you get the GSM off of the hardware serial port, the sooner you’ll understand serial communications and be able to make progress.

if you could just tell me how to initialise and store data in format YY/MM/DD.HH:MM:SS , it would mean a lot.
then i could use serial moniter to display the data.

How do you want to represent the data? ASCII digits? BCD? Straight binary? Are the slashes and colons real or implied?

the special characters are real and data is ASCII

So, use a string.

You send a command over the serial port of the Arduino micro. That command goes to both the PC (through USB) and to the GSM module (directly) over the TX line of the Arduino micro.

Next you get a reply back from the GSM module over the RX line of the Arduino micro. That reply does not go to the PC so how can you see it on the PC? Some configuration on hyperterminal?

You need two serial ports on the Arduino; check out the software serial library to communicate with the GSM module (and don't use pins 0 and 1 for that) and use the hardware serial port to communicate with the PC.

The below is based on your code (not using SoftwareSerial because you don't seem to listen to PaulS' advise) and just shows how to read the Serial data.

char rxbuffer[512];
void setup()
{
  Serial.begin(9600);

  // switch internal LED off
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);

  Serial.print("AT+CLTS=1;\r\n" );// sends the clts command to the gsm module, clts returns local time stamp
}

void loop()
{
  static int rxcount = 0;

  if(Serial.available() > 0)
  {
    if(rxcount == sizeof(rxbuffer))
    {
      digitalWrite(13, HIGH);
    }
    else
    {
      rxbuffer[rxcount++]=Serial.read();  
    }
  }
}

I have moved the clts command to setup so it's only called once. In the loop, it simply receives and stores the data in a buffer. I've made that buffer very big as I don't know how big the reply will be. If it's more than 512 characters, the on board LED will light up indicating buffer overflow.

You can use Serial.print to send the content of rxbuffer to the PC; be aware that that will also send it to the GSM module.

As said, look at SoftwareSerial.

int i;
char mystring[20]={""};// will this program store the value of serial input in mystring????
void setup() {
        Serial.begin(9600);     
}

void loop() 
{

        // send data only when you receive data:
        if (Serial.available() > 0) 
       {
          for (i=0;i<20;i++)
          
                // read the incoming byte:
                 mystring[i]= Serial.read();

            
        }
}
 if (Serial.available() > 0)
       {
          for (i=0;i<20;i++)
         
                // read the incoming byte:
                 mystring[i]= Serial.read();

Check to see if there’s a character available to read, then go ahead and read all twenty of them?
No.
Never.

Read Robin2’s serial handling basics tutorial.