How to add a current timestamp in text of a template?

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
OlyWater
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: Sun Jan 04, 2026 9:47 am

How to add a current timestamp in text of a template?

Post by OlyWater »

I'm trying to make a modification to the NOAA-monthly-imp template that came preloaded with a new PRO2. I want to add a line into the export file text that will insert the date and time that the export event takes place. Ideally, the line in the template would produce text in this format:

Report generated MM/DD/YYYY hh:mm

I've tried several variations of text and variables, starting with

$Report generated [MM]/[DD]/[YYYY] [hh]:[mm]

When the template is run, it appears that the date and time variables are picking up the values for the moment that the month started rather than the time of the export event. I'm inferring that this is related to the template being a tabular month-oriented product, so it starts with the first day of the month in generating it's output. As we're currently in February of 2026, the exported text that results is "Report generated 02/01/2026 00:00".

I'm theorizing that there may be some variant of the [mbsystem] variable that might get me what I'm looking for, but I haven;t been able to figure out what the proper syntax or modifying switches (selectors and converters, to use the MB Wiki terminology) would be.

Is anyone aware of a variable construction that will produce the output I'm looking for?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7951
Joined: Mon Oct 01, 2007 10:51 pm

Re: How to add a current timestamp in text of a template?

Post by admin »

When doing an upload the upload file name can reflect upload timestamp by using the % parameters as defined for "strftime".

I don't have an immediate idea how to punch creation time (not bound to the time frame where the data is requested for) into the document itself.
Post Reply