Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 12th, 2006, 9:07 AM   #1
nascar2000
Newbie
 
Join Date: Apr 2006
Posts: 9
Rep Power: 0 nascar2000 is on a distinguished road
help

hello everybody , i am doing a vb project and needs some help. i currently store the date and time details in access database. i want to retreive the time to a textbox. but when i retreive the time the date also show up. how do i limit to time only

thx.
nascar2000 is offline   Reply With Quote
Old Nov 12th, 2006, 11:57 AM   #2
alphonso
Programmer
 
Join Date: Dec 2005
Location: Philippines, where the seasons are: hot, and hotter
Posts: 72
Rep Power: 3 alphonso is on a distinguished road
Next time, don't put words like "help", "please...", and other words that don't specifically say anything.

What was the object you used to call your MS Access file?
__________________
"The most incomprehensible idea about the universe is that it is comprehensible" - Albert Einstein
alphonso is offline   Reply With Quote
Old Nov 12th, 2006, 1:20 PM   #3
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
show us some code so we can help.. i have posted something about MSAccess and dates before, you should also search the forums b4 posting..
what are you using ? oledbreader..?
hbe02 is offline   Reply With Quote
Old Nov 12th, 2006, 8:02 PM   #4
nascar2000
Newbie
 
Join Date: Apr 2006
Posts: 9
Rep Power: 0 nascar2000 is on a distinguished road
reply

what i mean is this. i want to extract the time from the date function. that is one question. the other one is when i extract a time from the database it shows wrong time,which is not stored in my database , could anyof you explain to me why?

thx
nascar2000 is offline   Reply With Quote
Old Nov 12th, 2006, 9:09 PM   #5
Samuaijack
Programmer
 
Samuaijack's Avatar
 
Join Date: Jul 2006
Location: using Earth.Africa.Egypt.Cairo;
Posts: 76
Rep Power: 3 Samuaijack is on a distinguished road
Quote:
show us some code so we can help
:beard:
Samuaijack is offline   Reply With Quote
Old Nov 13th, 2006, 4:08 AM   #6
alphonso
Programmer
 
Join Date: Dec 2005
Location: Philippines, where the seasons are: hot, and hotter
Posts: 72
Rep Power: 3 alphonso is on a distinguished road
We can take literally hundreds of guesses to your question if you don't have the codes posted
__________________
"The most incomprehensible idea about the universe is that it is comprehensible" - Albert Einstein
alphonso is offline   Reply With Quote
Old Nov 13th, 2006, 10:13 AM   #7
melbolt
Professional Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4 melbolt is on a distinguished road
here's one way to do it

vbnet Syntax (Toggle Plain Text)
  1. Public Class Form1
  2.  
  3. 'make a date variable
  4. Dim theDate As New DateTime
  5.  
  6.  
  7. ''' <summary>
  8. ''' form load handler
  9. ''' </summary>
  10. ''' <param name="sender"></param>
  11. ''' <param name="e"></param>
  12. ''' <remarks></remarks>
  13. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  14. 'get the date and time and put it in the variable
  15. theDate = Now
  16. End Sub
  17.  
  18.  
  19. ''' <summary>
  20. ''' button click handler
  21. ''' </summary>
  22. ''' <param name="sender"></param>
  23. ''' <param name="e"></param>
  24. ''' <remarks></remarks>
  25. Private Sub btnFullDateTime_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFullDateTime.Click
  26. 'with date and time
  27. MsgBox(theDate)
  28. End Sub
  29.  
  30. ''' <summary>
  31. ''' button click handler
  32. ''' </summary>
  33. ''' <param name="sender"></param>
  34. ''' <param name="e"></param>
  35. ''' <remarks></remarks>
  36. Private Sub btnTimeWithSeconds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeWithSeconds.Click
  37. 'get the time portion of theDate and split it on the "." to remove the milliseconds, return the 0 index item of the string array
  38. MsgBox(theDate.TimeOfDay.ToString.Split(".")(0))
  39. End Sub
  40.  
  41.  
  42. ''' <summary>
  43. ''' button click handler
  44. ''' </summary>
  45. ''' <param name="sender"></param>
  46. ''' <param name="e"></param>
  47. ''' <remarks></remarks>
  48. Private Sub btnTimeWithoutSeconds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimeWithoutSeconds.Click
  49. 'displays the time with only hours and minutes
  50. MsgBox(theDate.TimeOfDay.ToString.Split(":")(0) & ":" & theDate.TimeOfDay.ToString.Split(":")(1))
  51. End Sub
  52. End Class


so as you can see, i basically just handled it like a string and parsed out the part of it i wanted in each case.

one button displays the full date and time

another button displays time only, with seconds

and the third button displays time only, without seconds



I'm not going to code the whole program, I'll leave the retrieval of the datetime object from the MSAccess Database up to you, but here is how you can manipulate it once you've retrieved it to get the value you desire out of it.


cheers :banana:
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:23 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC