Hey! Unfortunately for the Gen 1/Gen 2 tamas - as they're remakes of the original P1 and P2s from 1996 and '97, respectively -, they don't have a save function. Sadly, your Tamagotchi can't really be preserved if you change the batteries over, which was always a shame with these older tamas Sorry about that!
If it's any comfort, later Tamagotchi models (for example the often forgotten Connection line from around 2004 and onward) do have a save function, so that when you replace the battery, your tama will be safe and sound - though you might have to readjust the clock however, haha! Either way, for your model, it's a bit of a shame. But you can rest easy knowing your tama's probably gone back to Tamagotchi Planet in your absence!