Results 1 to 7 of 7
  1. #1
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61

    Trimming TIME off your project

    Actually, this has more 2 do with trimming TIME itself.

    Say I've got dim TDstamp as date and I set TDstamp = #5/19/2018 10:47:46 AM#

    Then later, I want to modify the value to #5/19/2018 10:47: AM# (trimming off the seconds, you see)

    Seeking simple (elegant preferred) suggestion that would result in the following...



    Debug.Print ElegantFN(TDstam)
    5/19/2018 10:47:00 AM

    Any and all contributions will be met with the utmost level of appreciation.

    yeah... Me!MyOldLady = Now()

  2. #2
    Join Date
    Apr 2017
    Posts
    1,679
    Code:
    = INT(TDstamp) + ROUND((TDstamp-INT(TDstamp))*(12*60),0)/(12*60)

  3. #3
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    Quote Originally Posted by ArviLaanemets View Post
    Code:
    = INT(TDstamp) + ROUND((TDstamp-INT(TDstamp))*(12*60),0)/(12*60)
    Thanks, ArviLaanemets. I'll have a go at it.
    Kind regards,
    yeah

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    or just Format(TDstamp,"mm/dd/yyyy") ?
    EDIT: never mind. Don't know why I thought the whole time portion wasn't needed. I'll shut up now.

    EDIT2:
    Wait a sec! Why not just format as "mm/dd/yyyy hh:mm" ?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    Quote Originally Posted by Micron View Post
    or just Format(TDstamp,"mm/dd/yyyy") ?
    EDIT: never mind. Don't know why I thought the whole time portion wasn't needed. I'll shut up now.

    EDIT2:
    Wait a sec! Why not just format as "mm/dd/yyyy hh:mm" ?
    Answer: Because that does not evaluate to #5/19/2018 10:47:00 AM#

  6. #6
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    Quote Originally Posted by ArviLaanemets View Post
    Code:
    = INT(TDstamp) + ROUND((TDstamp-INT(TDstamp))*(12*60),0)/(12*60)
    ? DateValue(TDstamp) & " " & Hour(TDstamp) & ":" & Minute(TDstamp) returns a string that can be recognized as a time/date representation.
    But it's a string and would have 2B operated on with DateValue to turn it into a calculable time 'n date value. So I like yours better.
    I was hoping for a one-shot wonder - something that didn't resemble half-a-paragraph on a typed page.
    Last edited by yeah; 05-19-2018 at 05:31 PM. Reason: to make more clear

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Format(TDStamp,"mm/dd/yyyy hh:nn") & ":00 " & Format(TDStamp,"AMPM")
    OR
    Format(TDStamp,"mm/dd/yyyy hh:nn:00 AMPM")
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Trimming Internal Spaces from a String
    By J Bhujanga in forum Queries
    Replies: 2
    Last Post: 02-27-2017, 04:51 PM
  2. Project, time, client, contact tracking
    By windwardmi in forum Database Design
    Replies: 2
    Last Post: 07-04-2011, 05:18 PM
  3. Replies: 27
    Last Post: 06-25-2011, 07:33 PM
  4. First time using access. big project.
    By TrKent in forum Access
    Replies: 12
    Last Post: 06-23-2011, 12:28 PM
  5. Need Help Trimming Field!!
    By emarchant in forum Programming
    Replies: 7
    Last Post: 12-07-2010, 09:48 AM

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