Is it possible to have one data table (Weather_UTC) store measurements in UTC, and have another store in local time (Weather_CST)? This would be good for using the data in different softwares.
Thanks!
Curt
Sure. First decide if you want reference time to be in UTC, Local Standard, or Local Daylight time.
There are two ways to do this: either return another time stamp in date-time format or return a string. Returning date-time format helps with pushing the data into a SQL server or other. However, returning a string, the data logger automatically handles the offset conversion based on the "UTCOffset" setting (applicable for CR6 and CR1000X loggers {and maybe others}).
I live in Central Standard Time so my offset is -6 hours. So I set my "UTCOffset" to -21,600 seconds in Device Configuration Utility.
I'll demo using UTC as my station time and converting to local time for my additional table field. (CR1000X)
Public PTemp, Batt_volt Public UTCOffset As Long Public TmStamp_Local As Long Public TmStamp_Local_Str As String * 52 DataTable (Test,1,-1) 'Set table size to # of records, or -1 to autoallocate. DataInterval (0,15,Sec,10) Minimum (1,Batt_volt,FP2,False,False) Sample (1,PTemp,FP2) Sample (1,TmStamp_Local,NSec) Sample (1,TmStamp_Local_Str,String) EndTable BeginProg Scan (1,Sec,0,0) PanelTemp (PTemp,60) Battery (Batt_volt) UTCOffset = 6*3600-DaylightSavingUS(-1) TmStamp_Local = Public.TimeStamp(1,1) - UTCOffset TmStamp_Local_Str = Public.TimeStamp(2,1) CallTable Test NextScan EndProg
And if you're going the other way from Local to UTC, then add on the UTCOffset variable instead of subtract. The way I'm using DaylightSavingUS defaults to normal United States behavior and will automatically adjust the clock using the post-2007 dates. Omit if this doesn't apply.
Thanks so much for this! This is exactly what I've been looking for. I want to basically have my base timestamps set to UTC, and add a column for local time. Right now, I'm just having Loggernet set to Eastern Standard Time year round using the Bonus Tip from the Blog entry Daylight Saving Time and Your Data Logger (campbellsci.com)