Hi,
Types commonly override the Object.ToString method to return a string that represents the object instance. For your above case, the type of $a1 is DateTime and the method is DateTime.ToSting that converts the value of the current DateTime object to its equivalent string representation. If the type doesn't override the ToSting method, it still calls the default Object.ToString() method. You can get the type using the GetType() method.
https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tostring
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.