473,385 Members | 1,930 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.

Period dates ( AAAA-MM-DD )

Period dates ( AAAA-MM-DD )

Hi all.

I use this code ASP for insert period dates ( AAAA-MM-DD ) in a table Mysql, without Saturday and Sunday.

Expand|Select|Wrap|Line Numbers
  1.  
  2. by = "2008-05-02"
  3. to = "2008-05-12"
  4.  
  5. date = by
  6.  
  7. while not date > to
  8.  
  9.   if weekday(date) > 1 and weekday(date) < 7 then
  10.     sql = "INSERT INTO tbl (campo) VALUES ('" & date & "')"
  11.     cn.execute(sql)
  12.   end if
  13.  
  14.   date = dateAdd("d",1,date)
  15.  
  16. wend
  17.  
  18.  
Now I should exclude in the insert these dates ( MM-DD ):

01-01
01-06
04-25
05-01
06-02
08-15
11-01
12-08
12-25
12-26

Can you help me ?
Thanks

Mike
May 3 '08 #1
5 1959
omerbutt
638 512MB
mike ,
i am not clear with your problem what are you trying to do, and for the format of date in mysql , it supports only year-month-date you can only store in this format and while retrieving you can change it to display with your desired format
can you explain a little more
May 3 '08 #2
thanks x your reply...

The example date range is :

Date_1 = "2008-04-23"
Date_2 = "2008-04-26"

The day's of the date range is:

2008-04-23, 2008-04-24, 2008-04-25, 2008-04-26

I exclude in the insert database the day 2008-04-25.

You understand me ?
May 3 '08 #3
omerbutt
638 512MB
mike,
whats the moto behind that ,ii mean overall what you want to do i know you want to exclude a specific date or day while inserting these values inthe databse but it will not be "2008-04-25" each time ,is it related to any specific day of the week.
http://www.w3schools.com/VBscript/vb..._functions.asp
May 3 '08 #4
mike,
whats the moto behind that ,ii mean overall what you want to do i know you want to exclude a specific date or day while inserting these values inthe databse but it will not be "2008-04-25" each time ,is it related to any specific day of the week.[link]http://www.w3schools.com/VBscript/vbscript_ref_functions.asp[/link]

omerbutt,
I not understand you... sorry...
May 3 '08 #5
DrBunchman
979 Expert 512MB
Mike, looking at your original post, it seems that you want to exclude from your list any dates which are a Saturday or a Sunday - is this correct?

You can use the Weekday(Date) function to return an Integer value representing the day of the week and then test for that before doing your insert.

Hope this helps,

Dr B
May 5 '08 #6

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

Similar topics

3
by: CrystalDBA | last post by:
I am using SQL Server 2000. I need to query my database for all the contracts that came in during a certain time frame (user is prompted for reportingperiodid). Table - Periods Fields -...
3
by: www | last post by:
Hi there, I need to calculate working days for a given period, "Date from", "Date To". Plus I want to be able to insert Public Holidays to exclude aswell. Your help will be greatly appreciated....
17
by: Sue | last post by:
<html> Is there someone here that can help me validate the period as the fourth from the last character in an email address. There is other information and validation on the form I have to do but...
9
by: Ray | last post by:
I need to convert the normal calendar to show the week no., the period no. and the financial year. The financial year format is as follows:- Date start: 2 May, 2005 7 days a week, 4 weeks a...
3
by: jannoergaard | last post by:
Hi I want to write a function that can return a sum for a given date range. The same function should be able to return the sum for the same period year before. Let me give an example: The...
4
by: Mayhem05 | last post by:
I'm hoping someone can guide me on solving this vexing problem I have with a database I built to track a projects. I'm using MS Access 2003 and here are the basics: the database is designed to...
0
by: tavares | last post by:
International ECCOMAS Thematic Conference VipIMAGE 2007 - I ECCOMAS THEMATIC CONFERENCE ON COMPUTATIONAL VISION AND MEDICAL IMAGE PROCESSING 17-19th October 2007, FEUP, Porto, Portugal...
2
by: van_haan | last post by:
My database of customers has customers with begin_date and end_date. Each year has 13 periods (each 4 weeks begins a new period). I have a problem with calculating number of active customers per...
19
by: RZ15 | last post by:
Hi, Through google, I found a code for a public function that retrieves the fiscal period from a table by evaluating dates. The table is structured as follows: tblFiscalPeriods StartDate...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.