Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: piyush Vaishnawswami
  Where is piyush Vaishnawswami?
 Rajkot
 India
 piyush Vaishnawswami
 Tags
Subject: RE: How to Between Time???
Thread ID: 330923 Message ID: 330985 # Views: 32 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Sunday, December 25, 2011 11:55:18 AM         
   


> >
> >
> > lcStTime = CTOT(DTOC(DATE())+SPACE(1)+'08:00:00 PM')
> > lcEnTime = CTOT(DTOC(DATE())+SPACE(1)+'12:00:00 PM')
> >
> >
> > Anil
> >
> >
> > Accounting Software
> >
> > Web Development
> >
> > Accounting, Inventory, Hotel Management, Restaurant Kot Billing, MLM, Excise Accounting and much much more!.
> > My Blog
>
>
> Please Check
>
> SET HOURS TO 24
> SET DATE BRITISH
> LOCAL a as Datetime ,b as Datetime ,c as Datetime
> a = CTOT('25/12/2011 03:00:00PM')
> b = CTOT('25/12/2011 02:00:00PM')
> c = CTOT('25/12/2011 12:00:00PM')
> MESSAGEBOX(BETWEEN(a,b,c))
>
>
> Return .F.

That shows the danger of working with dates in character format instead of date format. Using an expression like
? BETWEEN(CTOT(DTOc(DATE())+ ' 8:47:00 pm'),DATETIME(),DATETIME()+3600*24)
it doesn't matter if the user chooses British date display, or 12 or 24 hour settings.
VFP will handle PM and AM correctly even if you SET HOURS TO 24.

-Anders

ENTIRE THREAD

How to Between Time??? Posted by piyush Vaishnawswami @ 12/24/2011 2:50:38 PM
RE: How to Between Time??? Posted by Anil Sharma @ 12/24/2011 3:04:47 PM
RE: How to Between Time??? Posted by piyush Vaishnawswami @ 12/24/2011 3:19:34 PM
RE: How to Between Time??? Posted by Anil Sharma @ 12/24/2011 3:30:42 PM
RE: How to Between Time??? Posted by piyush Vaishnawswami @ 12/25/2011 11:15:42 AM
RE: How to Between Time??? Posted by Anders Altberg @ 12/25/2011 11:55:18 AM
RE: How to Between Time??? Posted by Jignesh Parekh @ 12/25/2011 2:29:53 PM
RE: How to Between Time??? Posted by Anders Altberg @ 12/25/2011 6:09:04 PM
RE: How to Between Time??? Posted by Anil Sharma @ 12/25/2011 2:35:37 PM
RE: How to Between Time??? Posted by Rahul Moudgill @ 12/25/2011 6:15:56 AM