How can I save the number that I digit?

Thanks for reading my question. My idea is the following I have an arduino, keypad and LCD screen. What I want is that on my screen say press 1 say: Enter the time. Then the number is typed and that number is entered to save it. I have already achieved the rest I just need the last save that number, because I put it this way the code and put it this way because I could not find another way to put it. How can I save the number I enter? I appreciate your opinion. Sorry if I do not explain myself well, I do not speak English very well

#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
int t=0;
long first = 0;
long second = 0;
double total = 0;

char customKey;
const byte ROWS = 4;
const byte COLS = 4;

char keys[ROWS][COLS] = {
byte rowPins[ROWS] = {7,6,5,4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {3,2,1,0}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup()
lcd.begin(16, 2); // start lcd


void loop()

customKey = customKeypad.getKey();
if(customKey != NO_KEY){

if(customKey == ‘0’){

customKey = customKeypad.getKey();
if (customKey != NO_KEY)
  theNumber = (10 * theNumber) + customKey - '0'; 

Start theNumber at 0
Say you enter a 3. theNumber will be (10 * 0) + 3, ie 3
Then you enter a 5. theNumber will be (10 * 3) + 5, ie 35
and so on

By the way, clearing the LCD when a '0' is entered may not be a good idea

Thank you very much, if I worked. Could you answer me another question? in another question I post thank you. I am new I will give you the whole score if it can be given.

Could you answer me another question?

Feel free to ask another question. If it related to this one then add it to this thread. If not then start a new one.

yes it is related, the other question is how can I make the numbers I enter go down to the row below, that is from left to right but in row 2? is that I want to put row 1 "enter the time" but I can not because the numbers are put in row 1

The answer was given by UKHeliBob thank you very much for responding, right now I have the doubt of how to make the numbers write from left to right but in the row below and not in the first, because in the first row I want to put a text

I already found how to solve it was only to remove leftToRight (); and use my variable where I keep it that I call it “t” and that place it in the row below setCursor (6.1); for example