displaying date and time

i want to display current date and time in TFT screen.
how can i get them as variables ?

    #define LCD_CS A3
    #define LCD_CD A2   
    #define LCD_WR A1   
    #define LCD_RD A0   

    #define LCD_RESET A4

    #define   BLACK           0x0000
    #define   BLUE            0x001F
    #define   RED             0xF800
    #define   GREEN           0x07E0
    #define   CYAN            0x07FF
    #define   MAGENTA         0xF81F
    #define   YELLOW          0xFFE0
    #define   WHITE           0xFFFF

    #include "TFTLCD.h"
    #include <Keypad.h>
    #include <Button.h>

    const byte ROWS = 5;
    const byte COLS = 4;
    char buff[50];
    long lastUpdate = 0;
    int x,i,e,k,e1,e2,e3,e4,e5,x1,x2,f,e6;
    int w = 100;
    int h=150;
    
    byte b;  
    char inbytes[10]; 
    
    int bytesRead;
    char buffer[24];
    int j;
    int total_read = 0;
    
    
     char key;


    Button button = Button(8,PULLUP);  
    TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

    char keys[ROWS][COLS] =
    {
      {'1','6','E','N'},
      {'2','7','B','M'},
      {'3','8','I','X'},
      {'4','9','T','Y'},
      {'5','0','D','Z'},

    };

    byte rowPins[ROWS] = {40,39,38,37,36}; //connect to row pinouts
    byte colPins[COLS] = {32,33,34,35}; //connect to column pinouts

    Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
    
   void setup(void)
    {
      Serial.begin(115200);
      Serial.println("      User Interface Menu Started!        ");
      tft.reset();
      tft.initDisplay();
    }

    void(* resetFunc) (void) = 0;

     void loop(void)
{
      
  if(button.isPressed())
  {
     testtext8(BLACK) ; 
     testfillcircles(17, RED);
    delay(1500); 
   testfastlines(BLUE,BLUE);
     delay(1500);
   
   resetFunc();                                                      /////// BUTTON PRESS RESET
  }

.....................................................................................

You can't. The Arduinos have no idea of the current date or time. You could fit a RTC (look in the playground) but sync'ing it with the real world can be fun.

Mark

Hi rajie,
I've done the RTC but a few times, you need something like the DS1307 IC, (look for data sheet) you can det this up with the current date, time, etc and has lonf as you keep it powered up in remembers it, use a CR2032 Li battery to keep it going when the rest in powered down. There's a few sketches to set the time and read it. I only ever use the cheap 2x16/20 Char LCD modules, but it does what I want and that's OK.

Again there's lots of Arduino sites with schematics, etc.

Here's a couple of pictures, hope it helps

Regards

Mel.

thanks a lot sir.
i ill go through this ....