Reef controller problems

Hi everyone, i`m Rob hope your all well

I`m new to all things arduino but am having trouble i have a arduino mega a ds1302 RTC and a 8 relay unit and a 128x64 glcd with other bits

so far i have managed to wire all the glcd up and can get it to display the day,date,time and also can get it to read from a temp sensor and print the temp with max and min readings i can also get the arduino to switch a relay on and off, all quite simple to you all probably

Now my problem is i am trying to get my arduino to switch the relays on and off at certain times of day and i cannot find the code anywhere that helps me read the time ans switch a relay?

cant post my code so far but if required i can do it later today.

Thanks in advance for your help.

here is my code comp was playing up but managed to get the code i hope its all there as i`v had to copy and paste into 3 lots.

#include <glcd.h>
#include <glcd_Buildinfo.h>
#include <glcd_Config.h>
#include <DS1302.h>
#include <fonts/allFonts.h>
// Init the DS1302
DS1302 rtc(2, 3, 4);

void setup()
{
// Set the clock to run-mode, and disable the write protection
rtc.halt(false);
rtc.writeProtect(false);
GLCD.Init();

GLCD.SelectFont(Arial_14);
// The following lines can be commented out to use the values already stored in the DS1302
rtc.setDOW(MONDAY); // Set Day-of-Week to FRIDAY
rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(20, 2, 2012); // Set the date to August 6th, 2010
}
void loop()
{
GLCD.CursorTo(0, 0);

GLCD.print(“Robs Reef Controller”);
delay(2000);
GLCD.ClearScreen();

GLCD.CursorTo(0, 0);

// Send Day-of-Week
GLCD.print(rtc.getDOWStr());

GLCD.CursorTo(0, 1);

// Send date
GLCD.print(rtc.getDateStr());

GLCD.CursorTo(0, 2);
// Send time
GLCD.println(rtc.getTimeStr());
delay(2000);
GLCD.ClearScreen();
GLCD.CursorTo(7, 1);
int pin = 0; // analog pin
int tempc = 0,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
int i;
for(i = 0;i<=7;i++){ // gets 8 samples of temperature

samples = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
tempc = tempc + samples*;*
delay(100);
}
tempc = tempc/8.0; // better precision
tempf = (tempc * 9)/ 5 + 32; // converts to fahrenheit
if(tempc > maxi) {maxi = tempc;} // set max temperature
if(tempc < mini) {mini = tempc;} // set min temperature
GLCD.SelectFont(System5x7, BLACK);
GLCD.CursorTo(0, 0);
GLCD.print("Tank Temp, ");
GLCD.CursorTo(0, 1);
GLCD.print(tempc,DEC);
GLCD.print(" oC, ");
GLCD.CursorTo(0, 2);
GLCD.print(maxi,DEC);
GLCD.print(" Max, ");
GLCD.CursorTo(0, 3);
GLCD.print(mini,DEC);
GLCD.println(" Min,");
GLCD.SelectFont(Arial_14);
tempc = 0;
delay(5000);
GLCD.ClearScreen();
}

Right i`v figured the code out and sorted it but now i have another problem,

can i either run 2 codes at the same time on 1 arduino or can i delay part of my sketch without it delaying the rest?

you can break your code into separate functions and call them as necesary from Loop(), or you can put code inside conditional block inside Loop().

Haha done it. thanks mate.