VB 6.0 - VB 6 0 Date Function - Asked By Sobia Aqeel on 26-Sep-05 02:23 AM

I am new in VB Development, I want to ask about Date function. If We have entered a date through a text box then how can we convert it into Date data type.

you can use CDate function - Asked By Dharshana Jagoda on 26-Sep-05 02:32 AM

eg

dim d as date

d = CDate(Text1.Text)

date conversion - Asked By Patrick R. on 26-Sep-05 04:27 AM

Use IsDate() to check for a valida date
and CDate() to convert it

We can use Format function - Asked By Sunitha Nambari on 26-Sep-05 04:54 AM

hi,

   We can use Format function
Format(36715.5784, "m-d-yy")             7-8-00 
Format(36715.5784, "d-mmmm-y")      8-July-00 
Format(36715.5784, "mmmm yyyy")    July 2000 
Format(36715.5784, "hh:mm a/p")      01:52 p 
Format(36715.5784, "m/d/yy h:mm")  7/8/00 13:52 

For additional info browse this link:
http://www.comriesoftware.net/codewidgets/product.aspx?key=163

Regards,
Suneetha
Format Function - Asked By Sameer Jain on 26-Sep-05 09:09 AM
See these

Expression Result 
Format(36715.5784, "general date")....... 7/8/00 1:52:54 PM 
Format(36715.5784, "short date") ....... 7/8/00 
Format(36715.5784, "medium date").......  08-Jul-00 
Format(36715.5784, "long date") ....... Saturday, July 08, 2000 
Format(36715.5784, "short time") ....... 13:52 
Format(36715.5784, "medium time") ....... 01:52 PM 
Format(36715.5784, "long time") ....... 1:52:54 PM 
Format(36715.5784, "c") ....... 7/8/00 1:52:54 PM 
Format(36715.5784, "d").......  8 
Format(36715.5784, "dd").......  08 
Format(36715.5784, "ddd") ....... Sat 
Format(36715.5784, "dddd")....... Saturday 
Format(36715.5784, "ddddd").......  7/8/00 
Format(36715.5784, "dddddd") ....... Saturday, July 08, 2000 
Format(36715.5784, "w") ....... 7 
Format(36715.5784, "ww").......  28 
Format(36715.5784, "m") ....... 7 
Format(36715.5784, "mm") ....... 07 
Format(36715.5784, "mmm").......  Jul 
Format(36715.5784, "mmmm").......  July 
Format(36715.5784, "q") ....... 3 
Format(36715.5784, "y") ....... 190 
Format(36715.5784, "yy").......  00 
Format(36715.5784, "yyyy") ....... 2000 
Format(36715.5784, "h") ....... 13 
Format(36715.5784, "hh").......  13 
Format(36715.5784, "n") ....... 52 
Format(36715.5784, "nn") ....... 52 
Format(36715.5784, "s") ....... 54 
Format(36715.5784, "ss").......  54 
Format(36715.5784, "ttttt") ....... 1:52:54 PM 
Format(36715.5784, "AM/PM").......  PM 
Format(36715.5784, "am/pm").......  pm 
Format(36715.5784, "A/P") ....... P 
Format(36715.5784, "a/p") ....... p 
Format(36715.5784, "AMPM") ....... PM 


Notes: Some of this formatting is duplicated by easier-to-use Date and Time functions. Results of the named formats (short date, medium date, etc.) may vary depending on Control Panel Regional Settings. 


Format "w" returns day of week (1 = Sunday, 7 = Saturday) 
Format "ww" returns week of year (1-53) 
Format "y" returns day of year (1-366) 
Format "h" returns hour of day as one or two digits...if necessary 
Format "hh" returns hour of day as two digits...definitely 
Above applies to "n"/"nn", and "s"/"ss" as well 
Format "AMPM" uses settings from WIN.INI [intl] s1159=AM, s2359=PM 

Try mixing and matching the format strings Expression Result 
Format(36715.5784, "m-d-yy") ....... 7-8-00 
Format(36715.5784, "d-mmmm-y").......  8-July-00 
Format(36715.5784, "mmmm yyyy") ....... July 2000 
Format(36715.5784, "hh:mm a/p") ....... 01:52 p 
Format(36715.5784, "m/d/yy h:mm") ....... 7/8/00 13:52 



Some more links

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconformattingnumbersdatestimes.asp

Thanks
How to create multiple columns in a combo box? - Asked By Ralph Acido on 27-Sep-05 08:53 PM
Im creating a simple application. My problem is how can i display 2 fields in a combo box. Like for example i want to display (00001    Heizel Mamuad)... 00001 is the ID Number  and Heizel Mamuad is the Name of the student(fileds in a table).. any help?

Thank you...
How to create multiple columns in a combo box? - Asked By Mukesh Singh on 05-Oct-05 07:56 AM
There are no such properties to assign two fields into a combo. The alternate solution is to combine both the fields with -- of $ sign and then feed into same combo.

Example:-
                  dim rs_temp as adodb.recordset
                  dim strsql as string
                  Set rs_temp = New ADODB.Recordset
                  strsql = "Select Id,component From M_BLOOD_COMPONENT "
                  rs_temp.Open strsql, Cn
                  cmbCmpName.Clear
                   Do Until rs_temp.EOF
                             cmbCmpName.AddItem rs_temp!Id &"--"& rs_temp!Component
                             rs_temp.MoveNext
                   Loop
                   rs_temp.Close
addition of dates - Asked By neha gupta on 07-Feb-06 05:30 AM
if date is 2/7/2006 then 2/7/2007 that is addindg 1 year to it

if date  2/7/2007 then to get 5/2/2007, 8/2/2007,10/2/2007,1/2/2008. .........
that adding 3 months to date
addition of dates - Asked By neha gupta on 07-Feb-06 05:34 AM
if date is 2/7/2006 then 2/7/2007 that is addindg 1 year to it

if date  2/7/2007 then to get 5/2/2007, 8/2/2007,10/2/2007,1/2/2008. .........
that adding 3 months to date