Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How FormatDateTime?

I have the following codes in my work:

Dim Data_hoje As DateTime = DateTime.Now

FormatDateTime(Format(Data_hoje, "d"), DateFormat.ShortDate)

However, the FormatDateTime appears as error and says: Name FormatDateTime is not declared.

The Format and DateFormat also appear with same error. Why will be? How I will be able to decide this?

replied

Use Data_hoje.ToString("d", DateTimeFormatInfo.InvariantInfo) to format a DateTime in .NET if you want to format it to the invariant culture. If you are formatting it for a B1 DataSource, I think you need to use

Data_hoje.ToString("yyyyMMdd")

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question