Exporting Date() to a Text File without exporting the time too

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Howarth
    New Member
    • Dec 2010
    • 22

    Exporting Date() to a Text File without exporting the time too

    I am exporting a Query to a Text File. One of my fields is the current Date. F1:Date()

    When I look at the text file, my date is displaying the System Date which includes the time.
    Example: 10-29-2012 0:00:00

    I only want to export the date portion but can't figure out how to get rid of the time portion.
    Desired Result: 10-29-2012

    In the query, I did try playing with the Field Properties with Format = Short Date and Input Mask = 99/99/0000, but this did not give me my Desired Result.

    Any suggestions?
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32656

    #2
    Use a string value from the Format() function. The Format property of a non-string field is only used in certain circumstances where humans are involved and doesn't change the fact that the field is intrinsically a Date/Time field. The value returned by the Format() function, on the other hand, is not a Date at all, but a string. Exactly what you require :-)

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      Build a calculated field in the query using the following:format([field],"yyyy-MM-dd") this will take the date value in the [field] and convert it to the string... in this case something like "2012-10-29"
      Last edited by zmbd; Oct 30 '12, 03:25 AM. Reason: NeoPa... I shouldn't have looked up that URL ;-)

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Most Welcome...
        That little format function is really usefull once the formating strings are mastered... take notice of the "sections" within the formatting string (about 1/2 thru the link) they will become usfull in alot of situations.

        Comment

        Working...