SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
manipulating date format.

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
manipulating date format.
Author Message
nico



Joined: 08 May 2001
Posts: 13

Post manipulating date format. Reply with quote

I am using the FileDate to get the date of a file. However I want it to be padded. Meaning always in the MM/DD/YY format (always having 8 characters, including the 2 forward slashes). If the files date is Janurary 9th, 2002, I want it to return 01/09/02 (8 chars like I want) instead of 1/9/02 (6 chars -- not good).

How do I go about doing so?

Thanks in advance,
Nico

Wed Jan 09, 2002 6:55 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: manipulating date format. Reply with quote

Yes, it can be done. To answer your question I need to know how you use the returned date value, a script fragment would be helpful.

: I am using the FileDate to get the date of a file. However I want it to be
: padded. Meaning always in the MM/DD/YY format (always having 8 characters,
: including the 2 forward slashes). If the files date is Janurary 9th, 2002,
: I want it to return 01/09/02 (8 chars like I want) instead of 1/9/02 (6
: chars -- not good).

: How do I go about doing so?

: Thanks in advance,
: Nico

Wed Jan 09, 2002 7:44 pm View user's profile Send private message
nico



Joined: 08 May 2001
Posts: 13

Post Re: manipulating date format. Reply with quote

I'm actually just outputting it to my own log file.
using:

// Logging the check
Concat( "", today, line2 )
Concat( line2, " ", line2 )
Concat( line2, now, line2 )
Concat( line2, "\tUP_CHECK", line2 )
Concat( line2, "\tHeartbeat:\t", line2 )
Concat( line2, up_file_date, line2 )
Concat( line2, "\t", line2 )
Concat( line2, up_file_time, line2 )

the var up_file_date is the one i want to be 8 char's at all times.
I researched the @ - macro-parameters and tried using:

Set down_file_date "@T"mm/dd/yy""

before the excerpt of code I pasted above but it still did not work.

Whatcha think?

: Yes, it can be done. To answer your question I need to know how you use the
: returned date value, a script fragment would be helpful.

Wed Jan 09, 2002 7:50 pm View user's profile Send private message
nico



Joined: 08 May 2001
Posts: 13

Post Re: manipulating date format. Reply with quote

Blah I hope I'm not confusing you. In my previous post I said I used:

Set down_file_date "@T"mm/dd/yy""

I meant to say that I tried to use

Set up_file_date "@T"mm/dd/yy""

I got all my var's correct, don't worry :)

-Nico

: I'm actually just outputting it to my own log file.
: using: // Logging the check
: Concat( "", today, line2 )
: Concat( line2, " ", line2 )
: Concat( line2, now, line2 )
: Concat( line2, "\tUP_CHECK", line2 )
: Concat( line2, "\tHeartbeat:\t", line2 )
: Concat( line2, up_file_date, line2 )
: Concat( line2, "\t", line2 )
: Concat( line2, up_file_time, line2 )

: the var up_file_date is the one i want to be 8 char's at all times.
: I researched the @ - macro-parameters and tried using: Set down_file_date
: "@T"mm/dd/yy""

: before the excerpt of code I pasted above but it still did not work.

: Whatcha think?

Wed Jan 09, 2002 7:53 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: manipulating date format. Reply with quote

One suggestion... single ConcatEx can replace a bunch of Concat calls

Example: ConcatEx( today, " ", now, "\tUP_CHECK\tHeartbeat:\t", &

up_file_date, "\t", up_file_time, line2 )

Even more efficient is the following example
ConcatEx( today, " ", now, &

"\tUP_CHECK\tHeartbeat:\t@T"mm/dd/yy"\t@T"hh:mm:ss"", line2 )

: Blah I hope I'm not confusing you. In my previous post I said I used: Set
: down_file_date "@T"mm/dd/yy""

: I meant to say that I tried to use

: Set up_file_date "@T"mm/dd/yy""

: I got all my var's correct, don't worry :)

: -Nico

Wed Jan 09, 2002 8:22 pm View user's profile Send private message
nico



Joined: 08 May 2001
Posts: 13

Post Re: manipulating date format. Reply with quote

I don't understand how that will work. It is in the variable up_file_date that contains the files date. How are you using that date with the line:

: "\tUP_CHECK\tHeartbeat:\t@T"mm/dd/yy"\t@T"hh:mm:ss"",

That you wrote above. Instead of referencing the var up_file_date you are just using @T"mm/dd/yy" I don't understand how it knows that is coming from the var up_file_Date when you aren't using it anymore?

Please explain,
Nico

: One suggestion... single ConcatEx can replace a bunch of Concat calls

: Example: ConcatEx( today, " ", now,
: "\tUP_CHECK\tHeartbeat:\t", &

: up_file_date, "\t", up_file_time, line2 )

: Even more efficient is the following example
: ConcatEx( today, " ", now, &

:
: "\tUP_CHECK\tHeartbeat:\t@T"mm/dd/yy"\t@T"hh:mm:ss"",
: line2 )

Wed Jan 09, 2002 8:27 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: manipulating date format. Reply with quote

It is not coming from the up_file_date variable, I just saw from your code fragment that you initiate the variable using the Set statement then use the variable in Concat statements only. The up_file_date isn't being used in other places, is it?

That variable simply contains the system date, not the date of some file. Why don't skip the "Set" step and insert the @-macro parameter (which is just a substitution value) directly into the output line?

: I don't understand how that will work. It is in the variable up_file_date
: that contains the files date. How are you using that date with the line:
: That you wrote above. Instead of referencing the var up_file_date you are
: just using @T"mm/dd/yy" I don't understand how it knows that is
: coming from the var up_file_Date when you aren't using it anymore?

: Please explain,
: Nico

Wed Jan 09, 2002 9:55 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.