Date and Time Formats

Actions that include date and time values, such as “get current date and time”, “50 days from today is what date?”, or “find out what day of the week falls on a certain date” are common. When you write queries by using the SMS Query Builder interface, or when you compose reports from information stored in the SMS site database, you can express the date and time in any valid SQL format. An example would be any expression that has a SQL Server datetime data type or that can be converted implicitly, such as an appropriately formatted character string — “1998.10.31” for example.

Storage of times in the SMS site database could be local or Greenwich mean time (GMT). The status message viewer can convert to local time, but queries and reports cannot. What you see might be seven hours later than expected, if local time is Pacific Daylight. Therefore, the user must be aware of the following:

  1. Status messages are all GMT
  2. Offers can be GMT or local, depending on a switch set in the SMS Administrator console. The property in SMS_Advertisement is AssignedScheduleIsGMT (True/False).
  3. Inventory is always local time.

Crystal Reports will display what is stored and cannot make time zone conversions. If the report concerns status messages, label the times GMT. If it is an inventory report, label the times as local time. For advertisement reports, you have to check the value of AssignedScheduleIsGMT to get the time style being used. This property is “lazy,” meaning it is not exposed to the Query Builder or to Crystal Reports, but you can view it using WBEMTEST. See Chapter 8, “Using Network Discovery Architecture,” in the section, “Accessing Discovery Data.”

Depending on the context, you may encounter time notations in the following universal format:

19981118175900000000+***

Key:
1998year
11month
18day
1759hour
00second
000000microsecond
+***offset from local time

The following table lists valid datetime formats that you can use with the Query Builder:


Table B.1 Valid Datetime Formats

Style number without centuryStyle number
with century

Type

Output style
0 or 100Defaultmon dd yyyy hh:mm
1101USAmm/dd/yyyy
1102ANSIyyyy.mm.dd
3103British/Frenchdd/mm/yyyy
4104Germandd.mm.yyyy
5105Italiandd-mm-yyyy
6106dd-mon-yyyy
7107mon.dd.yyy
8 or 108hh:mm:ss
9 or 109mon dd yyyy

hh:mi:ss:mmmAM (or PM)

10110USAmm-dd-yy
11111JAPANyy/mm/dd
12112ISOyymmdd
13 or 113dd mon yyyy

hh:mi:ss:mmm (24 h)

14114hh:mi:ss:mmm (24 h)

Besides full datetime formats, you can also use datepart formats, which are also valid for the Query Builder or for writing reports from the SMS site database. Datepart formats provide only part of the full datetime format, the year, or just the day of the month, for example. The following table lists valid datepart formats:


Table B.2 Valid Datepart Formats

datepart ValueAbbreviationLimits
YearYy1753-9999
MonthMm1-12
DayDd1-31
HourHh1-23
MinuteMi0-59
SecondSs0-59
MillisecondMs0-999