How can one convert a "Date/Time" value to a "Date Only" value?

  • 1
  • 2
  • Question
  • Updated 2 years ago
  • Answered

'5/6/2015 7:00 AM'  to '5/6/2015'

Photo of Sam

Sam

  • 10 Points

Posted 4 years ago

  • 1
  • 2
todate([my date time field])
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
ToDate([date time field])


My formula is better as it preserves the UpperCamelCase of the documentation and is easier to read. Many aspects of QuickBase are case insensitive but your formulas and URL actions are more readable when using the appropriate case.

Wikipedia on CamelCase
https://en.wikipedia.org/wiki/CamelCase
But when you save the formula, QuickBase fixes the CapiTalization of the formula fUnctions and the field names, so yes, I was just being lazy knowing it would clean up my sloppiness.  

But I do agree that sometimes when you are comparing to some text field = " A text String"  or a Contains function, I have not totally nailed down when the Case matters.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
>But when you save ...

Maybe true but it also applies to the "actions" and formulas. I would stay away from these variants and use consistent capitalization:

?a=TD
?act=api_editrecord
DBID()
Photo of Krissy

Krissy

  • 110 Points 100 badge 2x thumb
What field type do I use for this formula?  Formula Text, Formula Date, Formula Date/Time, etc.?
Formula date.
Photo of Jay (DDS)

Jay (DDS)

  • 430 Points 250 badge 2x thumb
Is there a way to show only the time, and not the date, in this scenario?
If you have a date/time field, there are field properties which allow you to control the display format, including if you want to display the time at all..
Photo of Jay (DDS)

Jay (DDS)

  • 430 Points 250 badge 2x thumb
Right...but is there a way to ONLY show the time, not the date.  Here's the scenario.  I'm designing a registration system for my office, for visitors that come in to our lobby.  I'm using the Date Created field as the field to determine the time that the visitor arrived, but I don't need to see the date on the table report, just the time.  Make sense?  It's early for a Monday.  :)  Thanks for the help!
The easiest way is to make a new formula field of type "Time Of Day" with the formula
ToTimeOfDay([my date / time field])
Photo of Jay (DDS)

Jay (DDS)

  • 430 Points 250 badge 2x thumb
Worked like a charm!  I had done that, but had the wrong field type.  I had Date/Time instead.  So, next question would be, how can i populate a field with the time a field is changed.  Currently, I have this in the formula url, but it still prints the date AND time.  Is there something I can do to make it just print the time?

& "&_fid_20=" & URLEncode (Now())
try this, assuming that fid 20 is a time of day field (or I guess a text field) .

& "&_fid_20=" & URLEncode (ToTimeOfday(Now()))