Is there any way to get date time now and store it to variable ?

What i want to do is to get time each half of an hour

So on first half it should store one date time to %time variable. Second time after another half it should store to %time1 variable and so on.