If I use the following script -->

Const CONVERT_TO_LOCAL_TIME = True

Set dtmStart = CreateObject("WbemScripting.SWbemDateTime")
dtmStart.SetVarDate Now, CONVERT_TO_LOCAL_TIME
dtmRegular = dtmStart.GetVarDate(CONVERT_TO_LOCAL_TIME)
dtmNew = DateAdd("d", -37, dtmRegular)
Wscript.Echo dtmNew
wscript.quit

<--

I get an output something similar to 5/6/2007 10:11:10 AM

Is there a way to trim off the time information? I'm writing a script to
determine the date of a folder, and then if it is older than say 4 months,
delete it. Unfortunately, the time information is also there, and so the
script never deletes the folder.

Any Ideas how I can trim that time info off of there?

Thanks

Re: scripting folder date by Michael

Michael
Tue Jun 12 17:49:09 CDT 2007

D wrote:
> If I use the following script -->
>
> Const CONVERT_TO_LOCAL_TIME = True
>
> Set dtmStart = CreateObject("WbemScripting.SWbemDateTime")
> dtmStart.SetVarDate Now, CONVERT_TO_LOCAL_TIME
> dtmRegular = dtmStart.GetVarDate(CONVERT_TO_LOCAL_TIME)
> dtmNew = DateAdd("d", -37, dtmRegular)
> Wscript.Echo dtmNew
> wscript.quit
>

justTheDate = DateValue(dtmNew)
Wscript.Echo justTheDate

> <--
>
> I get an output something similar to 5/6/2007 10:11:10 AM
>
> Is there a way to trim off the time information? I'm writing a
> script to determine the date of a folder, and then if it is older
> than say 4 months, delete it. Unfortunately, the time information is
> also there, and so the script never deletes the folder.
>
> Any Ideas how I can trim that time info off of there?
>
> Thanks

--
Michael Harris
Microsoft.MVP.Scripting



Re: scripting folder date by D>

D>
Wed Jun 13 07:57:42 CDT 2007

Thanks!


"Michael Harris (MVP)" <mikhar.at.mvps.dot.org> wrote in message
news:eq$8kPUrHHA.5092@TK2MSFTNGP04.phx.gbl...
>D wrote:
>> If I use the following script -->
>>
>> Const CONVERT_TO_LOCAL_TIME = True
>>
>> Set dtmStart = CreateObject("WbemScripting.SWbemDateTime")
>> dtmStart.SetVarDate Now, CONVERT_TO_LOCAL_TIME
>> dtmRegular = dtmStart.GetVarDate(CONVERT_TO_LOCAL_TIME)
>> dtmNew = DateAdd("d", -37, dtmRegular)
>> Wscript.Echo dtmNew
>> wscript.quit
>>
>
> justTheDate = DateValue(dtmNew)
> Wscript.Echo justTheDate
>
>> <--
>>
>> I get an output something similar to 5/6/2007 10:11:10 AM
>>
>> Is there a way to trim off the time information? I'm writing a
>> script to determine the date of a folder, and then if it is older
>> than say 4 months, delete it. Unfortunately, the time information is
>> also there, and so the script never deletes the folder.
>>
>> Any Ideas how I can trim that time info off of there?
>>
>> Thanks
>
> --
> Michael Harris
> Microsoft.MVP.Scripting
>
>