Skip to main content
Inspiring
December 23, 2008
Question

DatePart question

  • December 23, 2008
  • 2 replies
  • 542 views
I am trying to do a datepart on a time datatype field in a mysql db and having some problems displaying the hour. For a simple explanation of what I am trying is this:
#DatePart("h", getLastedit.eventstarttime)#
This gives:
Parameter validation error for the DATEPART function.
The value of parameter 2, which is currently getLastedit.eventstarttime, must be a class java.util.Date value.

According to TFM I appear to be using it correctly, unless I cannot call the field I am wanting this way. Help anyone?
    This topic has been closed for replies.

    2 replies

    Inspiring
    December 23, 2008
    rmorgan wrote:
    >
    > According to TFM I appear to be using it correctly, unless I cannot call the
    > field I am wanting this way. Help anyone?
    >

    Two things to confirm here.

    One, does the field getLastedite.eventstarttime contain a data value,
    not a string that happens to look like a date to some people? I.E. is
    the field in the database a date field?

    Two, How are you referencing your query object? Sometimes, depending on
    how one references the query, one also needs to provide a row reference.
    This would look like this:

    #DatePart("h",getLastEdit.eventstarttime[1])#
    OR
    #DatePart("h",getLastEdit['eventstarttime'][1])#
    OR
    #DatePart("h",getLastEdit.eventstarttime[currentRow])#
    OR
    #DatePart("h",getLastEdit['eventstarttime'][currentRow])#

    Or something to that affect.
    Inspiring
    December 23, 2008
    The error message implies that getLastEdit.eventstarttime is not a date field. Is it?
    rmorganAuthor
    Inspiring
    December 23, 2008
    quote:

    Originally posted by: Dan Bracuk
    The error message implies that getLastEdit.eventstarttime is not a date field. Is it?



    Its a time datatype, must it be a date field?