Check this MS documentation for ToString() methods.
Dim oNow As String = Now.ToString("yyyy MMMM dd")
MsgBox("oNow = " & oNow)
It appears I was a little slow on the draw. 😉
Wesley Crihfield
(Not an Autodesk Employee)
I don't understand the last part of the code, can you explain me the syntax please
I guess it can be quite a bit more complicated than you might expect. There appears to be tons of ways to manipulate DateTime data into the format you want. Below are a couple more links that you might find helpful/informational.
Standard date and time format strings
Custom date and time format strings
DateTimeFormatInfo.SortableDateTimePattern Property
DateTimeFormatInfo.UniversalSortableDateTimePattern Property
Wesley Crihfield
(Not an Autodesk Employee)
Hello
I want to change date format from dd/mm/yyyy to dd.mm.yyyy.
Hi @oliver_schmid08. Have you read any of the information at the Links posted above, or tried to do that formatting yourself yet? There are likely several different ways to get to a similar result, depending on what you are doing. Below are a couple more Links that may be of interest to you in a case like this. They point to two properties of the DateTimeFormatInfo object, where we can specify which character we want to use as the separator for date and time formatting, and they include some example code.
DateTimeFormatInfo.DateSeparator
DateTimeFormatInfo.TimeSeparator
And below is just one possible way to get to that type of result, but likely not the most proper or intuitive way.
Dim oDate As Date = DateAndTime.Today
Dim sDate As String = oDate.Day.ToString("00") & "." & oDate.Month.ToString("00") & "." & oDate.Year.ToString("0000")
MsgBox("Date = " & sDate,,"")
Edit: The following may be the shortest way to get that type of result, at least for me, but maybe not for everyone. The local language and culture where you are may play a role in how this works.
MsgBox("Date = " & Today.ToString("dd.MM.yyyy"),,"")
Wesley Crihfield
(Not an Autodesk Employee)
@oliver_schmid08
Hi, were you able to resolve this from the answer given by @WCrihfield
Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button. Thanks and Enjoy!
Chris Benner
Community Manager