excel vba - Difference between DateValue and CDate in VBA -


I am new to VBA and I am working on a module to read data from a spreadsheet and based on the date. I calculate the values ​​in the spreadsheet as a string, and then using the CDAT, I am changing prices at a date. Although I just ran during the date and I was wondering what was the difference between the two functions and which one is better to use.

date values ​​ will only return the date CDAT Will protect the date and time:

 ? Date value ("2014-07-24 15:43:06") 24/07/2014? CDT ("2014-07-24 15:43:06") 24/07/2014 15:43:06   

Similar to returning you timevilla Only time part can be used:

 ? Time Price ("2014-07-24 15:43:06") 15:43:06? Timeville ("2014-07-24 15:43:06") & gt; Time limit (12, 0, 0) is true   

Also, as guitararthar says, date value (and time value ) Only string parameters, while CDAT can handle numbers, to compute these functions for numerical types, CDate (Int (num)) < / Code> and CDate (num - Int (num)) .

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -