| View previous topic :: View next topic |
| Author |
Message |
bar Guest
|
Posted: Tue Mar 20, 2007 10:15 pm Post subject: datetime |
|
|
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
|
Posted: Wed Mar 21, 2007 1:06 am Post subject: Re: datetime |
|
|
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
|
Posted: Wed Mar 21, 2007 1:57 am Post subject: Re: datetime |
|
|
"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
|
Posted: Thu Mar 22, 2007 8:11 am Post subject: Re: datetime |
|
|
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
|
Posted: Thu Mar 22, 2007 3:13 pm Post subject: Re: datetime |
|
|
"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
|
Posted: Thu Mar 22, 2007 3:26 pm Post subject: Re: datetime |
|
|
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
|
Posted: Thu Mar 22, 2007 10:51 pm Post subject: Re: datetime |
|
|
"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
|
Posted: Sat Mar 24, 2007 2:56 pm Post subject: Re: datetime |
|
|
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
|
Posted: Mon Mar 26, 2007 7:59 pm Post subject: Re: datetime |
|
|
"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 |
|
 |
|