Control of the temporal profile of the local electromagnetic field near metallic nanostructures