DateTime.FormatStyles

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Enumeration
DateTime.FormatStyles

New in 2019r2

These are the various styles that can be used to convert a Date to String with the ToString method.

Values

Enum Description
Short The short date or time format:
  • 12/1/14
  • 12:23 PM
Medium The medium date or time format:
  • Dec 1, 2014
  • 12:20:06 PM
Long The long date or time format:
  • December 1, 2014
  • 12:23:53 PM EST
Full The full date or time format:
  • Monday, December 1, 2014
  • 12:24:17 PM Eastern Standard Time
None Prevents the date or time value from displaying.

Notes

The samples shown above are the typical default settings. The specific formats are defined in the locale settings for your OS:

  • iOS: Settings, General, Language & Region
  • Mac: Language & Region System Preference
  • Windows: Time & Language setting
  • Linux: varies by distribution

Sample Code

Var date1 As DateTime = DateTime.Now
Label1.Value = date1.ToString(Locale.Current, DateTime.FormatStyles.Full)