Page 1 of 1 1
Topic Options
#152130 - 2005-11-23 06:51 PM Problem with Split
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.

I am working a a script to get the last access time for standard and non-standard software. When I do a split statement to modify the date from yyyy/mm/dd to mm/dd/yyyy the year is not translating.
Code:
Dim $,$strLastaccess,$strLastAcc
$strLastaccess=GetFileTime($strPath+"\"+$filename,2)
$=Split ($strLastaccess,"/")
$strLastAcc=$[1]+'/'+$[2]+'/'+$[0]
?$strLastAcc



The results come out looking like this:
11/21 14:38:02/2005
_________________________
I haven't failed. I just found another way that did not work.

Top
#152131 - 2005-11-23 06:55 PM Re: Problem with Split
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Output the $strlastaccess to the console so you can see exactly what the split sees.

? $strLastaccess
_________________________
Today is the tomorrow you worried about yesterday.

Top
#152132 - 2005-11-23 06:57 PM Re: Problem with Split
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
$strLastaccess
Results:
2005/11/21 14:38:02
_________________________
I haven't failed. I just found another way that did not work.

Top
#152133 - 2005-11-23 07:18 PM Re: Problem with Split
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
so with your split command you are saying to split based upon the delimiter of "/" so you end up with
Array[0] = 2005
Array[1] = 11
Array[2] = 21 14:38:02

When you add element # 2 do a Left($Array[2],2) and you should only get the "21"
_________________________
Today is the tomorrow you worried about yesterday.

Top
#152134 - 2005-11-23 09:27 PM Re: Problem with Split
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
I just added the line:
Code:

$strLeft=Left ($strLastaccess,10)


and did the split using $strLeft
_________________________
I haven't failed. I just found another way that did not work.

Top
#152135 - 2005-11-23 10:37 PM Re: Problem with Split
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
That works just as well
_________________________
Today is the tomorrow you worried about yesterday.

Top
#152136 - 2005-12-01 09:51 PM Re: Problem with Split
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
The final line I came up with to resovle this is:

Code:
$strLastaccess=Left (GetFileTime($strPath+"\"+$filename,2),10)

_________________________
I haven't failed. I just found another way that did not work.

Top
#152137 - 2005-12-02 12:54 AM Re: Problem with Split
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
what about this

Code:

$strLastaccess=split(GetFileTime($strPath+"\"+$filename,2))[0]



Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 525 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.11 seconds in which 0.076 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org