+ Reply to Thread
Results 1 to 4 of 4

Dato format - time info not getting saved in variable

  1. #1
    Registered User
    Join Date
    10-21-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    21

    Dato format - time info not getting saved in variable

    Hi.

    Pretty simple question.
    I am pulling data from a Sybase server and the dates are imported like this:
    Please Login or Register  to view this content.
    Now, when i try saving the date to a variable, the 08.12.2013 00:00 becomes just 08.12.2013. On all the others the time info are getting saved correct.
    I have tried changing the variable to save it as Date,String,Char and just nothing but it doesn't help. Still cuts the time info away.

    This is how i read the cell. Tried adding the .Value but it didnt made any difference.
    Please Login or Register  to view this content.
    Is there an easy fix for this?
    Last edited by stibay; 12-07-2013 at 10:52 PM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,589

    Re: Dato format - time info not getting saved in variable

    Do you really need to fix it?
    If it is a genuine date
    Please Login or Register  to view this content.
    Or if you need it how it looks regardless of the data type then use .Text property
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-21-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Dato format - time info not getting saved in variable

    Hi.

    Thanks for your reply.

    Yes, I need to fix it since I do a date comparison so 00:00 is bigger than f.ex 22.00 and when its nothing it assumes that its bigger.

    I also see now that the value that's actually in the cell also have seconds. So when it saves the other variables it comes with milliseconds.

    Your Range("N" & t).Text seems to work but I adjusted your Format idea so it also includes the seconds. Just in case and then it gets 100% correct. (I think)
    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,589

    Re: Dato format - time info not getting saved in variable

    Then why not convert it to a numeric value to compare?
    e.g
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dato funksjoner
    By ovega in forum Non English Excel
    Replies: 8
    Last Post: 02-24-2013, 01:01 PM
  2. [SOLVED] Endre dato format
    By ovega in forum Non English Excel
    Replies: 0
    Last Post: 02-11-2013, 04:38 PM
  3. Replies: 3
    Last Post: 01-09-2012, 04:07 AM
  4. dato calkulations
    By Jv. in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-26-2006, 08:00 AM
  5. Faktura og dato
    By tmeb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-02-2006, 12:50 PM

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