Skip to main content
March 23, 2011
Answered

Error:Time defaulting to Midnight

  • March 23, 2011
  • 2 replies
  • 1407 views

Hi,

I have been using the Timeformat function in my table to output the time in "h:mm tt" format, Its working for a different cell on the same page with similar requirements but not on the current varaible(y) on the same page. But for the current variable(y), its defaulting to Midnight. And the DateFormat for the current variable(y) is using the same variable and its outputting correct dateformat. 

If I dump the form in the database, its giving me date and time in these format:

2011-03-22- 00:00:00.0

Which is correct for date part but not for the time part.

Here's the code:

#Dateformat(xx.lmn,"mm/dd/yyyy")#--#TimeFormat(xx.lmn,"h:mm tt")#

Am I missing something. Please help.

Vijayvijay77.

    This topic has been closed for replies.
    Correct answer Adam Cameron.

    I am getting the same value as mentioned in the previous post:

    2011-03-23 00:00:00.0

    The date field correct, but the time field deafulted to midnight.

    Thanks,

    Vijayvijay77.


    Well what do you expect?  timeFormat() needs something to work with!  There's no time component to that date, so - yes - timeFormat() will just output zeros.

    The problem lies with the data, not with timeFormat().

    How is the data going IN to the DB?  What is the column spec for the column the data is being stored in?

    --

    Adam

    2 replies

    Inspiring
    March 23, 2011

    On 3/23/2011 11:07 PM, vijayvijay77 said:

    2011-03-22- 00:00:00.0

    >

    Which is correct for date part but not for the time part.

    what do you get if you just dump out #xx.lmn#? are you sure there's time data in

    that column in your table?

    Inspiring
    March 23, 2011

    What is the value of xx.lmn?

    --

    Adam

    March 23, 2011

    queryname.datetimeobject.

    Thanks.

    Vijayvijay77.

    Inspiring
    March 23, 2011

    That's not a value, that's the name of a query column.  What's the value?

    --

    Adam