Dear All,

I just found out something weird.

When I create a new data, key-ing in all details and for date as well.

So when I click on the button Edit,

Yes I can perform the edit function, I can edit everything. Then, once I click on Save, yes it Saved.


But problem here in the date all goes back "1900-01-01".

Experts here, kindly advice on this issue and is there any solution for this.

Means, the first key in for the date is 2011-03-30 06:00:50

i edited the time to 07:10:15

After edit and save data , the date is changed to 1900-01-01 07:10:15.

Why is the date changed yet I did not do any modification on it?

Kindly HELPPPP....

Hi,

How exactly are you modifying the DateTime? Are you using DateAdd or are you just changing the time "manually".

It looks to me that either the modified date is in a format that the datetime picker can't understand and it is defaulting to January 1 1900. Or that your code is not adding time to the date properly.

Yeah... Probably because I split my date and time. I just grabbed the time to textbox for modification. Is this method wrong?

Am I not suppose to split the date and time?

Kindly advice..

Hi,

You can split out your time and date and just modify the time if you wish. But it looks like the picker is not recognising the date part that you put back in. I'd format the date into serial (yyyy-mm-dd) or extended format (dd MMM yyyy) it avoids confusion over US verses ROW date format (mm/dd/yyyy vs dd/mm/yyyy)

I'd do something like this:

sub SplitDateAndTime(byref Mydate as Date)
dim sDate, sTime as string

sDate = format(datevalue(mydate),"dd MMM yyyy")
textbox1.text = sDate

sTime = TimeValue(mydate)
textbox2.text = sTime
end sub

sub UpdateDate()
dim sDate as string

if isdate(textbox1.text) then
   sDate = textbox1.text &" " &textbox2.text
   TimePicker.value = trim(sDate)
end if
end sub

That should put the date value in the format of something like "30 Mar 2011 10:54:00" depending how you are passing in the time value.

Edited 5 Years Ago by G_Waddell: forgot a bracket in my code DOH!

Comments
Excellent Conclusion
This article has been dead for over six months. Start a new discussion instead.