Results 1 to 14 of 14
  1. #1
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434

    Eliminate time from date

    Hi


    i have a sharepoint list called "calendar" in which i have a date field; this field is just date field, in sharepoint has no time.
    i linked this sharepoint list to my access database, and in this database some dates have time to like "13/05/2020 1:00:00"

    i want to get rid of this time, i tried with an update query but did not work
    this is the table in a new database, please help
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    normally all fields would have both date/time.
    you can query it and format it for time only: Format([field],"hh:nn:ss")

  3. #3
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434
    thanks for the flash answer
    my first problem is: why some record has time and some other no?
    other question: and to format just for the date?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    if no time is there, it is 12 midnite

    for date: format([field]","dd/mm/yyyy")

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Have a look at the query qryCalendario, I wrapped the Initial and End dates (Fine calendario) in DateValue to remove the time part.
    Cheers,
    Vlad
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434
    thank you very much it was very useful

    i got however that my problem with vba filter was the date format, and i had to US format my date picker.
    thank you again

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    if you want to eliminate time from the underlying value, run an update query

    set myDate=datevalue(myDate)

    what you see as a date is just format of a number

    ?cdbl(now())
    43953.3601273148
    ?cdbl(date())
    43953
    ?cdbl(datevalue(now()))
    43953



    43953 is the number of days since 31/12/1899 and .3601273148 is the time expressed as number of seconds divided by the number of seconds in a day (86400)

  8. #8
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434
    thanks is a good idea to convert to number.
    put in my tool box

  9. #9
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434
    sorry to necroposting

    Code:
    If Me.DataInizioFilt <> "" Then      If FiltStr = "" Then
             FiltStr = " CDbl(DateValue([Data inizio]))  >= " & CDbl(DateValue(Me!DataInizioFilt)) & ""
          Else
             FiltStr = FiltStr & " AND cdbl(datevalue([data inizio])) >= " & CDbl(DateValue(Me!DataInizioFilt)) & ""
          End If
       End If
    the first part of the filter is not processed

    Code:
    CDbl(DateValue([Data inizio]))
    and it returns

    CDbl(DateValue([Data inizio])) >= 43950

    i can't figure out how to elaborate the first part CDbl(DateValue([Data inizio]))



    Quote Originally Posted by Ajax View Post
    if you want to eliminate time from the underlying value, run an update query

    set myDate=datevalue(myDate)

    what you see as a date is just format of a number

    ?cdbl(now())
    43953.3601273148
    ?cdbl(date())
    43953
    ?cdbl(datevalue(now()))
    43953



    43953 is the number of days since 31/12/1899 and .3601273148 is the time expressed as number of seconds divided by the number of seconds in a day (86400)

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    not sure what you mean

    CDbl(DateValue([Data inizio])) >= 43950

    is what I would expect (29th April)

    so what does this mean?

    i can't figure out how to elaborate the first part CDbl(DateValue([Data inizio]))

    and it returns me the string "





  11. #11
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434
    sorry, i meant that i have an error "kind of data not corresponding"

    my string filter is "CDbl(datevalue([Data inizio]))) >= 43950"

    both are date field, i can't find the error
    it returns a runtime error 3464

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    just realised you have 2 ( and 3 ) in your string

    me.filter="CDbl(datevalue([Data inizio]))) >= 43950"

    but you are making it overly complex - this should work

    me.filter="[data inizio]>=#04/30/2020#"


    the fact there is a time element is irrelevant for this sort of comparison

  13. #13
    Join Date
    Apr 2017
    Posts
    1,776
    I haven't Access available to check currently, but you converted the result of DateValue() to number, and as follows you get a number instead of date.

    Probably like
    FiltStr = "DateValue([Data inizio]) >= " & DateValue(Me!DataInizioFilt) & ""
    or (in case
    Me!DataInizioFilt is date without time component)
    FiltStr = "DateValue([Data inizio]) >= " & CDate(Me!DataInizioFilt) & ""

  14. #14
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434
    lookès like it is working

    " [Data inizio] >= #" & Format(Me!DataInizioFilt, "mm/dd/YYYY") & "#"

    cause we have a different date format

    i make some other tests but shoud be ok
    thanks again

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-16-2018, 04:58 PM
  2. Replies: 6
    Last Post: 04-19-2016, 03:58 PM
  3. Replies: 7
    Last Post: 04-11-2015, 10:19 AM
  4. Replies: 11
    Last Post: 07-20-2014, 06:22 PM
  5. Replies: 1
    Last Post: 03-13-2014, 07:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums