System.String.Format("Current Date is {0:f}", Now()) = "Current Date is Monday, February 08, 2006 4:28 PM" 

If you cannot find a standard date and time format that is appropriate you can create your own format putting together the special characters.

System.String.Format("Current Year is {0:yyyy}", Now()) = "Current Year is 2006" 

The / and : formatting characters are particularly elusive because they are replaced by the default date and time separator defined for the current locale.
When formatting dates for SQL SELECT statements you want to can make sure that the given separator is used on all occassions by using the backslash escape character to force a specific separator.

System.String.Format("{0:dd\/MM\/yyyy}", Now()) = "01/05/2006" 

System.DateTime.Now.ToString("hh:mm:ss") - this returns the current date and time 
System.DateTime.Now.ToString(ddd mmmm") - this returns the current date and time

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext