Skip to sidebar Skip to content
Ipercube Technical
Jack of all trades, master of none
Date: Time: - Stardate:
Welcome, Log in by clicking  Here!
SS64
MDN
Stack
Code
GitHub
Wiki
Convert
V Studio
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions
Ipercube Technical
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions

Format Ldap Date

Converts an LDAP timestamp (in the format “yyyyMMddHHmmssZ”) to a human-readable date and time string.

  • Removes the “.0” suffix if present, keeping the “Z” timezone indicator.
  • Parses the cleaned LDAP date string as UTC and converts it to a local time zone-aware format.
  • Useful for displaying LDAP date attributes (e.g., “whenCreated”, “whenChanged”) in a user-friendly way.
VB
    Public Function FormatLdapDate(RawDate As String) As String

        ' Remove ".0", keep "Z"
        RawDate = RawDate.Replace(".0", "")

        ' Now the format is "yyyyMMddHHmmssZ"
        Dim format As String = "yyyyMMddHHmmss'Z'"
        Dim parsedDate As DateTimeOffset = 
                            DateTimeOffset.ParseExact(RawDate, format, 
                            System.Globalization.CultureInfo.InvariantCulture)

        Return parsedDate.ToString("dd/MM/yyyy HH:mm:ss zzz")
    End Function
Posted by ipercube


© 2026 Ipercube Design