BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

datetime

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Students)
View previous topic :: View next topic  
Author Message
bar
Guest





PostPosted: Tue Mar 20, 2007 10:15 pm    Post subject: datetime Reply with quote



hello all
I have 3 fields in my database.
StartingDateTime
EndingDateTime
WorkingTime.

Can anybody suggest, the best way to accept the date and time from the user
on the form(interface) and give the workingtime.

Thanks
SA
Back to top
Vladimir Stefanovic
Guest





PostPosted: Wed Mar 21, 2007 1:06 am    Post subject: Re: datetime Reply with quote



Hi,


There are few problems with Date and Time.

There isn't any special component named TDBDateTime
or TDBDateTimePicker.

You'll have to improvise (unless you are not going to make
a new cmponent or use some 3rd party one).

Use a TDBEdit for viewing and editing date and time.

Previously make some preparations:

1. double click on Table object containing that DateTime field
2. right click / ad all fields
3. select that DateTime field
4. Set the DateTime format -> DisplayFormat
(not sure but EditMask is not needed if I remember well)

Also I suggest some other technique. After TDBEdit object
place some simple TButton which invokes classic TMonthCalendar
and/or TDateTimePicker for changing date and passing the result
to TDBEdit.



--
Best Regards,
Vladimir Stefanovic
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Mar 21, 2007 1:57 am    Post subject: Re: datetime Reply with quote



"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote in message
news:460016a3 (AT) newsgroups (DOT) borland.com...

Quote:
Can anybody suggest, the best way to accept the date
and time from the user on the form(interface)

Look at the TDateTimePicker component.


Gambit
Back to top
bar
Guest





PostPosted: Thu Mar 22, 2007 8:11 am    Post subject: Re: datetime Reply with quote

Hello all
i have a string "01-Mar-2007"
i want to assign this value to the datetime picker control
dtp->Date = StrToDate("01-Mar-2007");
but i am getting not a valid date
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Mar 22, 2007 3:13 pm    Post subject: Re: datetime Reply with quote

"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote in message
news:46022f94$1 (AT) newsgroups (DOT) borland.com...

Quote:
i have a string "01-Mar-2007"
i want to assign this value to the datetime picker control
dtp->Date = StrToDate("01-Mar-2007");
but i am getting not a valid date

That is because your string is not in the correct locale format for
your machine. That has nothing to do with the TDateTimePicker. Look
at the global ShortDateFormat variable for the proper formatting. You
may end up having to manually parse out the individual portions of the
value and then construct a TDateTime using EncodeDate().


Gambit
Back to top
bar
Guest





PostPosted: Thu Mar 22, 2007 3:26 pm    Post subject: Re: datetime Reply with quote

Thanks
I got it.
Is there any alternative. My task is to take 2 date time values

D1 = 1-Mar-2007 23:00
D2 = 2-Mar-2007 02:00

The differece in hours is 3 hours 0 minutes

Later i want to add some of these difference hours

Very greatful for the simple and good technique
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Mar 22, 2007 10:51 pm    Post subject: Re: datetime Reply with quote

"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote in message
news:460259e7 (AT) newsgroups (DOT) borland.com...

Quote:
My task is to take 2 date time values
snip
The differece in hours is 3 hours 0 minutes

This has been asked and answered many times before. Please go to
http://www.deja.com and search through the newsgroup archives.


Gambit
Back to top
bar
Guest





PostPosted: Sat Mar 24, 2007 2:56 pm    Post subject: Re: datetime Reply with quote

No luck.
i find only calculating time difference.
But i want to consider the date as well.
Many Thanks for the suggestion

Thanks
SA

"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote in message
news:460259e7 (AT) newsgroups (DOT) borland.com...
Quote:
Thanks
I got it.
Is there any alternative. My task is to take 2 date time values

D1 = 1-Mar-2007 23:00
D2 = 2-Mar-2007 02:00

The differece in hours is 3 hours 0 minutes

Later i want to add some of these difference hours

Very greatful for the simple and good technique
Back to top
Thorsten Kettner
Guest





PostPosted: Mon Mar 26, 2007 7:59 pm    Post subject: Re: datetime Reply with quote

"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote:
Quote:
No luck.
i find only calculating time difference.
But i want to consider the date as well.
Many Thanks for the suggestion

No find? Subtracting one TDateTime from another gives you the
difference in days, e.g. 1.5 for one and a half days.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Students) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.