473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

date problem

121 100+
i have a problem with dates i want to retrieve some records between two dates dates are input to two masked box.i have written the query like this
rssearch.Open "select * from timesheet where sname like'%" & txtstaffname.Text & "%'" & _
"and date =#" & mskfrom & "#", con, adOpenDynamic, adLockOptimistic
if mskfrom value is 01/01/2008 and msk is 04/01/2008
it gives result of four months but i want only jan 4 days result
pls help me database is msaccess
Feb 16 '08 #1
11 1096
lotus18
866 512MB
i have a problem with dates i want to retrieve some records between two dates dates are input to two masked box.i have written the query like this

Expand|Select|Wrap|Line Numbers
  1. rssearch.Open "select * from timesheet where sname like'%" & txtstaffname.Text & "%'" & _
  2.     "and date =#" & mskfrom & "#", con, adOpenDynamic, adLockOptimistic 
  3.  
  4.  
if mskfrom value is 01/01/2008 and msk is 04/01/2008
it gives result of four months but i want only jan 4 days result
pls help me database is msaccess

Hi

As i can see it seems like that the date format must be Day/Month/Year and not Month/Day/Year . You need Format function for that : )


Rey Sean
Feb 16 '08 #2
charvi
121 100+
Hi

As i can see it seems like that the date format must be Day/Month/Year and not Month/Day/Year . You need Format function for that : )


Rey Sean
i used format function but still it is not working
Feb 16 '08 #3
lotus18
866 512MB
i used format function but still it is not working
May I see the codes.BTW, have you checked the format of your date on your database?

Rey Sean
Feb 16 '08 #4
charvi
121 100+
May I see the codes.BTW, have you checked the format of your date on your database?

Rey Sean
but in database it stores in dd/mm/yyyy.but only after executing the query it compares with mm/dd/yyyy i used format function also
can any one help
Feb 17 '08 #5
charvi
121 100+
but in database it stores in dd/mm/yyyy.but only after executing the query it compares with mm/dd/yyyy i used format function also
can any one help
i have coded like this and my database stores data in dd/mm/yyyy format
but when i enter dates in textbox in dd/mm/yyyy format
for eg 01/01/2008 and 04/012008
here it compares o4 as month
and gives result upto april but iwant records till jan 4
can any one help
Feb 17 '08 #6
mafaisal
142 100+
Hello,

U Have Better to Use DTPicker to Select Date instead of textbox

Faisal

i have coded like this and my database stores data in dd/mm/yyyy format
but when i enter dates in textbox in dd/mm/yyyy format
for eg 01/01/2008 and 04/012008
here it compares o4 as month
and gives result upto april but iwant records till jan 4
can any one help
Feb 17 '08 #7
charvi
121 100+
Hello,

U Have Better to Use DTPicker to Select Date instead of textbox

Faisal
i used msk editor i cannot use date picker because some times a vaule is not entered
Feb 17 '08 #8
lotus18
866 512MB
Can you post some of your codes here?

What do you mean by this?

i used msk editor i cannot use date picker because some times a vaule is not entered
You can do a validation for that.
Feb 17 '08 #9
9815402440
180 100+
hi

open control panel and then open regional and language settings. here change short date format to dd/MM/yyyy.
this will solve your problam

regards
manpreet singh dhillon hoshiarpur
Feb 17 '08 #10
Killer42
8,435 Expert 8TB
Actually, it's quite simple. The database does not store dates in dd/mm/yyy, or mm/dd/yyyy, or any other such format. It simply stores a number. The formatting is only used in passing values to and fro, since they have to be placed in a string, and need to make sense to the reader.

The SQL interpreter (at least for Access, not sure about other DBMSs) requires American format. So take your date value and format it as mm/dd/yyyy when placing it in the SQL's WHERE clause. You can display it in whatever format you like. Generally it's best to use the Windows settings if possible, so that the end-user is not locked into what you consider the right format.

Where possible, I recommend using a less ambiguous format to prevent this sort of issue. For example, dd-mmm-yyyy (Eg. 21-Jan-2007). There's not much chance of getting the day and month mixed up in this case.

Manpreet, I think expecting everyone to set their Windows date format the same seems a bit unreasonable.
Feb 18 '08 #11
debasisdas
8,127 Expert 4TB
i used msk editor i cannot use date picker because some times a vaule is not entered
You can use the checkbox option of the control.
Feb 18 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Dominique Javet | last post by:
Hello, I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this "newbie" question... I've found no answer in the forum ... I've a date problem with my formular. In my mysql DB...
1
by: OzThor | last post by:
ok, re my post about using date's to load differen .js files... thanks... have it working now.... well almost.... I have a quiz here that loads a new set of questions each day... the...
7
by: Andy Davis | last post by:
I have a table of data in Access 2002 which is used as the source table for a mail merge document using Word 2002 on my clients PC. The data is transferred OK but I've noticed that any dates which...
0
by: Luis Esteban Valencia | last post by:
Hi, I am using windows 2000 Pro with SP4 for development and database is access2000. Regional Setting is as follows: Regional Options: Your locale(location): English United States short date...
0
by: Arpicheck | last post by:
Hi, I am writing a page that contains a texbox, a calendar, and a rangevalidator. The range validator is testing the textbox for date values. There is an event, set up to fire, when the...
3
by: seegoon | last post by:
Hi to all. I have a small problem I hope someone can help me with. I am running a sql query to a csv file. The query searches for the total of a column between 2 dates. This is a copy of one of...
15
by: edouard.spooner | last post by:
Hi, I have a tricky SQL query problem that I'm having probs with. I have a table which resembles something like this Date | Price1 | Price2 | Price3 01 Jan 2006 | 100 | 100 | 100 02 Jan...
2
by: hardik | last post by:
hi friends, i am really surprized the way access behaves in date fields i mean it's all ok when you have us time zone or us servers but if you have diffrent timezone like uk then access creates...
0
by: mykhan | last post by:
I have been using access database with asp.net pages. I just realized a problem with date saving in access table. I didnt give any specific format for the date when saved in tables, because I wanted...
3
by: Neil Chinneck | last post by:
Hi everyone, I have a weird problem, and I cannot work out what's going on. I have a continuous form (frmEnterCosts) based on a query (qryEnterCosts). I have series of unbound combo boxes to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.