Using %time% with ODBC log

General chat about HostMonitor (all messages posted before March 07, 2003 available here).
Locked
Guido39
Posts: 65
Joined: Tue Sep 17, 2002 6:00 pm

Post by Guido39 »

When logging to ODBC, the %time% macro comes out as "1/1/1900 2:52:47 PM" when using the datetime datatype in SQL Server. If I use a character type, it comes out correct. Should I be able to use datetime? I will be doing sorts on this field so would prefer to use that.
User avatar
Marcus
Posts: 367
Joined: Mon Nov 18, 2002 6:00 pm

Post by Marcus »

Use the %DateTime% macro. It will generate a valid field in SQL.
Guido39
Posts: 65
Joined: Tue Sep 17, 2002 6:00 pm

Post by Guido39 »

I did that too and that works correctly. The reason I'm also logging date and time is so I can do ASP queries by date and then within that query, display just the time since you already know the date. I probably could do some trimming of datetime but figured since time was an option, I would just use that.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

The %time% macro comes out as "1/1/1900 2:52:47 PM"? What time format has been set on your system (Control Panel->Regional options->Time format)?
By default HostMonitor uses default system time format. Probably its configured to display date as well? You can change system time format, or you can specify new time format for HostMonitor only using "Use fixed date&time formats" option located on Miscellaneous page in the Options dialog.

Regards
Alex
User avatar
Marcus
Posts: 367
Joined: Mon Nov 18, 2002 6:00 pm

Post by Marcus »

It's not Hostmonitor or a system setting. It's SQL which does the conversion from text to datetime format. Just use the %DateTime% macro and you will never run into problems.
Locked