Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Store Seconds in the log file?
Message
From
09/01/2023 13:56:39
 
 
To
08/01/2023 06:26:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01685718
Message ID:
01685749
Views:
56
>>I get similar results to your (except you see a dash and I see a slash)
>>SET DATE TO AMERICAN
>>? DATETIME() && shows "01/07/23 04:00:07 PM"
>>SET DATE TO ANSI
>>? DATETIME() && Shows "23.01.07 04:00:07 PM"
>>I prefer the date in my log to be shown as AMERICAN above (month/Date/Year...)
>
>ACK to Dragan and order of numbers.
>But as total app often needs local D/DT settings, I prefer ttoc(,3) or ttoc(,1) in .txt logs.
>No danger of wrong set carried over by some dumb error.

Yep, agree on using something that that doesn't depend on SET DATE and SET CENTURY, as well as using 24-hour rather than 12-hour format for time portion.

In case you wanted to "pretty up" the timestamp, you could use expression such as:
STUFF(STUFF(STUFF(STUFF(STUFF(TTOC(DATETIME(),1),13,0,":"),11,0,":"),9,0," "),7,0,"-"),5,0,"-")
to get it in the format YYYY-MM-DD hh:mm:ss

>If your own pref sometimes favors MDY, consider dbf logs.
>makes often sense, esp. if you view log as technical part.
>Users prone to give you their ideas or interpretation instead of info won't read the log
>Users with minimal knowledge can read (and set DT to their pref if given viewer or some tech info
>Size limit of 2GB minimally enhanced if using memo file for variable text part.
>(I prefer to get log mailed instead of user calling me with log info they read)

That's another good idea -- this also gives you option to do some form of reporting upon the logs.

On a similar note -- if I am generating some sort of output file with the date encoded into it, I opt for something that has YYYYMMDD format rather than something local date format --- mainly so that usual sorting alphabetically will also sort the files by date/time automatically. File timestamps aren't preserved whenever a file gets transferred (e.g. E-mail, FTP, etc.).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform