Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Change Time format of eventlog to desired format Problem ?

Avatar of yene
yene asked on
Programming Languages-OtherOperating SystemsScripting Languages
2 Comments1 Solution923 ViewsLast Modified:
Hi ,
I have data returned from eventlog using powershell .How can i change the time format to "ddMMyyyyThhmmss"
to retrieve the data and the time logged to text file.
So i need only how to change the time format of the event log to "ddMMyyyyThhmmss"?
Thank you.
Very Urgent

$Event = Get-EventLog -LogName PS_SCRIPT_LOG
$Event
Index  Time             Type              Source                  EventID     Message
-----    ----                  ----                  ------                   -------        -------
    2     Mar 03 12:13    Info            PS_SCRIPT                 0        datareturned
 
PS C:\Windows> ([datetime]$eevnt[0].TimeWritten) -format 'ddMMyyyyThhmmss'
You must provide a value expression on the right-hand side of the '-f' operator.
At line:1 char:37
+ ([datetime]$eevnt[0].TimeWritten) -fo <<<< rmat 'ddMMyyyyThhmmss'
 
#I also checked ([datetime]$eevnt[0].TimeWritten).GetDateTimeFormats() but nothing
ASKER CERTIFIED SOLUTION
Avatar of BSonPosh
BSonPoshFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers