Better way of displaying "modification time" of files

(imported topic written by SteveC91)

I have a relevance script that is retrieving file names and with it displaying the directory name, file size and modification time. I’d like to strip down the modification time to something other than “Wed, 06 Dec 2006 17:15:11 -0500”. Any hints on how to do that?

Thanks!

(imported comment written by jessewk)

Some ideas:

Q: date (local time zone) of time “Wed, 06 Dec 2006 17:15:11 -0500”

A: Wed, 06 Dec 2006

Q: (day_of_month of it as string & ", " & month_and_year of it as string ) of date (local time zone) of time “Wed, 06 Dec 2006 17:15:11 -0500”

A: 6, December 2006

Q: (year of it as string & "

" & month of it as integer as string & "

" & day_of_month of it as string ) of date (local time zone) of time “Wed, 06 Dec 2006 17:15:11 -0500”

A: 2006_12_6

Q: (year of it as string & month of it as integer as string & (if (day_of_month of it as integer < 10) then (“0” & day_of_month of it as string) else day_of_month of it as string )) of date (local time zone) of time “Wed, 06 Dec 2006 17:15:11 -0500”

A: 20061206

There are tons more options. Why don’t you post the format you’d like and we can tell you how to massage the modification time into that format.

As a side note, it’s a great idea to return less detail. If you use the full modification time, virtually every computer will return a different result. It is much lighter on console resources when you build your properties such that the number of unique results is minimized.

(imported comment written by SteveC91)

Being able to just have 2006/12/6 would work for me. Time would be nice, but really not a necessity.

Currently the retrieved property looks like this:

if exists ((files whose (name of it as string as lowercase contains “.exe” ) of folders of folder “C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5” )) then (concatenation " || " of ((following text of last “.IE5” of (location of it as string)) & “” & name of it as string & “-” & size of it as string & " bytes-" & modification time of it as string) of files whose (name of it as string as lowercase contains “.exe” ) of folders of folder “C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5” ) else “No”

(imported comment written by brolly3391)

Hello again Steve,

You date formatting would look like this:

((year of it as string & “/” & month of it as integer as string & “/” & day_of_month of it as string ) of date (local time zone) of it & " - " & (hour_of_day of it as string & “:” & minute_of_hour of it as string & “:” & second_of_minute of it as string) of time (local time zone) of it) of modification time of it

2006/12/7 - 11:40:10

inserted into your current property like this:

q: if exists ((files whose (name of it as string as lowercase contains “.exe” ) of folders of folder “C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5” )) then (concatenation " || " of ((following text of last “.IE5” of (location of it as string)) & “” & name of it as string & “-” & size of it as string & " bytes-" & ((year of it as string & “/” & month of it as integer as string & “/” & day_of_month of it as string ) of date (local time zone) of it & " - " & (hour_of_day of it as string & “:” & minute_of_hour of it as string & “:” & second_of_minute of it as string) of time (local time zone) of it) of modification time of it) of files whose (name of it as string as lowercase contains “.exe” ) of folders of folder “C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5” ) else “No”

It looks like you are searching internet caches for .exe files. As the Default User profile is never logged on, I don’t expect you will find anything under that user profile.

Cheers,

Brolly

(imported comment written by SystemAdmin)

I wanted a Last Report Time I could use to sort by in Excel reports so I modified brolly’s relevance a little and came up with this:

((year of it as string & “/” & (if (length of it =1) then (“0”&it) else it) of (month of it as integer as string) & “/” & (if (length of it =1) then (“0”&it) else it) of (day_of_month of it as string)) of date (“pdt” as time zone) of it & " - " & ((if (length of it =1) then (“0”&it) else it) of (hour_of_day of it as string) & “:” & (if (length of it =1) then (“0”&it) else it) of (minute_of_hour of it as string)) of time (“pdt” as time zone) of it) of (apparent registration server time)

Notes:

  1. I padded the Month, Date, Hour, and Minute fields with 0 using (if (length of it =1) then (“0”&it) else it) of (). This turns “2007/8/23 - 8:7” into “2007/08/23 - 08:07”

  2. All results have been normalized to the same timezone instead of local or universal. During daylight savings time you have to use “pdt” instead of “pst” for Pacific Time. You can add an additional check to see if the date falls within dst and use the appropriate time zone.