Position.DateTimeStamp Field

Indicates the date time value when the provider located the position of a locatable end point (such as a provisioned phone).

Public DateTimeStamp As System.String
[C#]
public System.String DateTimeStamp;

Remarks

Always expressed as a string in the Coordinated Universal Time (UTC) "G" format. For example if the date time stamp is Feburary 16, 1992, 12 hours, 15 minutes and 12 seconds, a string with value 2/16/1992 12:15:12 PM is returned.

The format of the date and time is always MM-DD-YYYY HH:MM:SS AM/PM irrespective of the current request's culture information found in the Culture property of the UserInfoLocationHeader class.

To convert this field to a valid DateTime instance use DateTime.Parse method or DateTime.ParseExact method with "G" or "g" (general short date and long time) formats. The culture information must be set to en-US for parsing.

This field is set to String.Empty when no value is provided by the provider.

Example

 
[Visual Basic]
    'This code snippet assumes that you have a valid Position 
    'object (MyPosition) returned from the MapPoint Location Web Service

    'Get the date time stamp in string format
    Dim MyDateTimeStamp As String = MyPosition.DateTimeStamp

    'Define a structure to hold the converted date time value
    Dim PositionTimeStamp As DateTime

    'Check if the date time string is null or empty
    If ((Not (MyDateTimeStamp = Nothing)) And MyDateTimeStamp.Length  0) Then
        'You can use either DateTime.Parse or DateTime.ParseExact methods
        'to parse the date time string into a valid date

        'Using DateTime.ParseExact method to parse the 
        'date time string to obtain the position time stamp
        'Set "en-US" culture information to format the date
        Dim culture As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US", True)
        'Define the expected formats for the date time stamp
        Dim expectedFormats As String() = New String() {"G", "g"}
        PositionTimeStamp = System.DateTime.ParseExact(MyDateTimeStamp, expectedFormats, _
                                culture, System.Globalization.DateTimeStyles.AllowWhiteSpaces)

        'Using DateTime.Parse method to parse the 
        'date time string to obtain the position time stamp
        PositionTimeStamp = System.DateTime.Parse(MyDateTimeStamp, culture)

        'Now display the date time in "fr-FR" culture format
        Dim frenchCulture As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("fr-FR", True)
        'Display the date time string in specific culture
        Console.WriteLine(PositionTimeStamp.ToString("G", frenchCulture))
    End If
 
 
[C#]
  //This code snippet assumes that you have a valid Position 
  //object (MyPosition) returned from the MapPoint Location Web Service

  //Get the date time stamp in string format
  string MyDateTimeStamp = MyPosition.DateTimeStamp;
  //Define a structure to hold the converted date time value
  DateTime PositionTimeStamp;

  //Check if the date time string is null or empty
  if(MyDateTimeStamp != null && MyDateTimeStamp.Length != 0)
  {
   //You can use either DateTime.Parse or DateTime.ParseExact methods
   //to parse the date time string into a valid date

   //Using DateTime.ParseExact method to parse the 
   //date time string to obtain the position time stamp
   //Set "en-US" culture information to format the date
   System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US", true);
   //Define the expected formats for the date time stamp
   string[] expectedFormats = new string[] {"G", "g"};
   PositionTimeStamp = System.DateTime.ParseExact(MyDateTimeStamp, expectedFormats, 
    culture, System.Globalization.DateTimeStyles.AllowWhiteSpaces);

   //Using DateTime.Parse method to parse the 
   //date time string to obtain the position time stamp
   PositionTimeStamp = System.DateTime.Parse(MyDateTimeStamp, culture);

   //Now display the date time in "fr-FR" culture format
   System.Globalization.CultureInfo frenchCulture = new System.Globalization.CultureInfo("fr-FR", true);
   //Display the date time string in specific culture
   Console.WriteLine(PositionTimeStamp.ToString("G", frenchCulture));
  }
  
 

See Also

Position Class