Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Prevent DateTime from being converted to 24-hour format

$
0
0

I have a script that grabs event log data and send the results in an email.  The time stamp of an event log entry shows up correctly in non-24hour format...for example 2:30 PM and not 14:30.

However when I send the email, the message body contains the event date (as a variable) but this event date is converted to 24 hour format.  I believe when the DateTime object is sent to the Send-MailMessage function, it must convert it to a STRING object for the message body.

Is there a way to prevent this or covert it back to non-24 hour format when adding it to the mail body variable?

Thanks

NK


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>