DateStamp command

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Kent Rukke
Newbie
Posts: 18
Joined: Fri Mar 19, 2004 4:59 pm
Location: Ephrata, Washington USA
Contact:

DateStamp command

Post by Kent Rukke » Tue May 11, 2004 3:50 pm

Is there any way to remove the colon between the date and the time that is written to the file by this command.

2004-05-11:08:30:04:578 would look like 2004-05-11 08:30:04:578

I think it would be more readable.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue May 11, 2004 6:53 pm

To get a timestamp in a log file
From this: 2004-05-11:08:30:04:578
To this: 2004-05-11 08:30:04:578
You could try something like this:
//Send TimeStamp to Temporary file
TimeStamp>TempFile

//Read contents of temporary file
ReadLn>Tempfile,1,DateTime

//Parse line in temp file to get Date, Time, Comment
MidStr>DateTime,1,10,DateStr
MidStr>DateTime,12,12,TimeStr
MidStr>DateTime,24,300,Comment

//Rebuild TimeStamp contents
Let>Stamp=%DateStr% %TimeStr% %Comment%

//Send rebuilt line to original log file
WriteLn>LogFile,result,%Stamp%
Be sure to eliminate any Trailing Space Characters.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Kent Rukke
Newbie
Posts: 18
Joined: Fri Mar 19, 2004 4:59 pm
Location: Ephrata, Washington USA
Contact:

Post by Kent Rukke » Tue May 11, 2004 7:02 pm

Thanks for the information Bob. I realize the ability to accomplish the change of the colon to a space is in the product.
I guess what I was asking was for a modification to the DateStamp command that would allow the scrip builder the ability to chose the format of the resulting data.

Lumumba

Post by Lumumba » Tue May 11, 2004 10:34 pm

To get this format: 2004-05-11 08:30:04 you could specify this:

Let>MyTimestamp = %YEAR%-%MONTH%-%DAY% %HOUR%:%MIN%:%SEC%

Sorry, I'm willing to ignore parts of a second :wink:

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue May 11, 2004 11:14 pm

Good shortcut for the front end Lumumba.

And I see you are also willing to forget the comments in the normal TimeStamp? :D Nah, you/ve just provided this to replace the MidStr functions I used.

We do all this, and he is just asking for an enhancement to the program!

:lol: :lol:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Guest

Post by Guest » Wed May 12, 2004 7:34 am

Have taken this from the settings of "Dave's Quik Search Desk Bar" as a sample for "some" parameters used with date/time :oops:

/* The clock is formatted according to the following format strings:
* yyyy - four digit year (2001)
* yy - two digit year (01)
* MMMM - fully spelled month name (January)
* MMM - abbreviated month name (Jan)
* MM - zero-padded month number (01)
* M - month number (1)
* dd - zero-padded day-of-month number (01)
* d - day-of-month number (1)
* hh - zero-padded 12-hour clock hour (01)
* h - 12-hour clock hour (1)
* HH - zero-padded 24-hour clock hour (01, 13)
* H - 24-hour clock hour (13)
* mm - zero-padded minutes value (00)
* ss - zero-padded seconds value (00)
* a - 12-hour clock am/pm lowercase (am)
* A - 12-hour clock am/pm uppercase (AM)
* EEEE - day-of-week full name (Monday)
* EEE - day-of-week abbreviation (Mon)
* default long form = " EEE d MMM yyyy h:mm A "
* default short form = " h:mm A "
* clocklongform = " EE MM dd, yyyy h:mm A ";
*/

A sample result out of the above:

clocklongform = " EEEE, dd.MM.yyyy - HH:mm ";
clockshortform = " h:mm A ";

So something like this isn't to far away from it (workaround :wink: ):

Let>MyTimestamp = %YEAR%-%MONTH%-%DAY% %HOUR%:%MIN%:%SEC%

and yep, it was just a part of the big picture :D

Label>Check
.
.
.

If>x=s, Success, Error

Label>Success
Let>StatusMessage = SUCCESS
Goto>WriteLog

Label>Error
Let>StatusMessage = ERROR

Label>WriteLog
Let>MyTimestamp = %YEAR%-%MONTH%-%DAY% %HOUR%:%MIN%:%SEC%
WriteLn>LogFile,result,%MyTimestamp% - %StatusMessage%
Goto, Check

Lumumba

Post by Lumumba » Wed May 12, 2004 7:39 am

The Guest above was me, myself and I :oops:

And I#ve forgotten to set the code tags :roll:

Lumumba

Post by Lumumba » Wed May 12, 2004 9:46 pm

Let's talk about NOW :!: :wink:

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts