+ Reply to Thread
Results 1 to 6 of 6

Remove the date from a date time field / make formatting permanent

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Remove the date from a date time field / make formatting permanent

    I have a column of date + time (e.g. 10/04/2012 12:57:35 AM ) and I used .NumberFormat to make it display 12:57 AM only. However because I want to work with the time only I actually want this to be a permanent change, not just a visual change (eg. when I click on it I want it to be 12:57 AM in the formula bar and not 10/04/2012 12:57:35 AM). How can I accomplish this?

    This is the code that I'm currently using:

    Please Login or Register  to view this content.
    Last edited by Ariadust; 10-10-2012 at 04:20 PM.

  2. #2
    Forum Contributor
    Join Date
    10-02-2012
    Location
    Bumi Nusantara
    MS-Off Ver
    Excel 2010; Excel 2016
    Posts
    136

    Re: Remove the date from a time field / make formatting permanent

    perhaps

    variable = column_value mod 1

    then format it to "h:mm AM/PM"

  3. #3
    Registered User
    Join Date
    09-21-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Remove the date from a time field / make formatting permanent

    Quote Originally Posted by dwint View Post
    perhaps

    variable = column_value mod 1

    then format it to "h:mm AM/PM"
    Hi, can you explain what mod 1 does to the column value? I'm still learning so I want to understand fully what I implement.

    Thanks!

  4. #4
    Forum Contributor
    Join Date
    10-02-2012
    Location
    Bumi Nusantara
    MS-Off Ver
    Excel 2010; Excel 2016
    Posts
    136

    Re: Remove the date from a time field / make formatting permanent

    actualy, date and time is as same as numeric, while integer is represent for each single date and decimal for hour & minute

    when you devided your date & hour value with 1, and then you get decimal number.. its the time that your looking for

    sorry, my english is not good.. i hope you understand what i mean.

  5. #5
    Registered User
    Join Date
    09-21-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Remove the date from a time field / make formatting permanent

    Quote Originally Posted by dwint View Post
    actualy, date and time is as same as numeric, while integer is represent for each single date and decimal for hour & minute

    when you devided your date & hour value with 1, and then you get decimal number.. its the time that your looking for

    sorry, my english is not good.. i hope you understand what i mean.
    I somewhat understand what you mean. However, I'm not sure on how to implement this. I'm getting a type mismatch error :
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-21-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Remove the date from a time field / make formatting permanent

    Bump, can anyone help implement dwint's solution or have another idea?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1