ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 17th, 2003, 09:11 PM
icepricessa's Avatar
icepricessa icepricessa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 199 icepricessa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 10 m 38 sec
Reputation Power: 6
Unhappy inserting a date value into sql server (urgent!!)

hi there i a slight problem i have a field which accepts the date as dd/mm/yyyy but when i insert the value it becomes mm/dd/yyyy for some date values like 9 april become 4 august.... the database date format is mm/dd/yyyy and i just take the value out and display it as dd/mm/yyyy.. however ... my update and inserts can't use the same function, cos the function is just display out the server's date as dd/mm/yyyy... how should i add i in correctly?

Code:
Dim ddate, ydate, mdate
Function FormatDateDM2MD(sdate) 
if sdate="" or sdate=" " then
FormatDateDM2MD = "NULL"
else
ddate=day(sdate)
mdate=month(sdate)
ydate=year(sdate)
sdate= ydate & "/"  & mdate & "/" & ddate

FormatDateDM2MD =  "'"&sdate&"'"
end if
End Function


hi again i have another problem my date values when its 10 of Nov it comes out as 11/10/2003 instead of 10/11/2003 why? how do i solve it?

here's my function
Code:
Function FormatMediumDate(DateValue)
    Dim strYYYY
    Dim strMM
    Dim strDD

        strYYYY = CStr(DatePart("yyyy", DateValue))

        strMM = CStr(DatePart("m", DateValue))
        If Len(strMM) = 1 Then strMM = "0" & strMM

        strDD = CStr(DatePart("d", DateValue))
        If Len(strDD) = 1 Then strDD = "0" & strDD

        FormatMediumDate = strDD & "/" & strMM & "/" & strYYYY
End Function 

the date is generated by a pop up calender.. u can view it here
www14.brinkster.com/siewhua/addPage.asp

Last edited by icepricessa : October 17th, 2003 at 09:27 PM.

Reply With Quote
  #2  
Old October 18th, 2003, 10:01 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
THe function works fine, you're probably just coding something incorrectly, i'd look at how you're using the function

Reply With Quote
  #3  
Old October 18th, 2003, 08:44 PM
icepricessa's Avatar
icepricessa icepricessa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 199 icepricessa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 10 m 38 sec
Reputation Power: 6
foe example?

Reply With Quote
  #4  
Old October 18th, 2003, 08:50 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
Do you know how functions work? Think of it like a variable, treat it the same way ex;
Code:
response.write FormatDateDM2MD(sdate)

or 

dim blah
blah = FormatDateDM2MD(sdate)


gives you the value you're looking for
PS happy 666 posts for me

Reply With Quote
  #5  
Old October 19th, 2003, 07:39 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 6
or u can try this popup date that can be customised to dd/mm/yyyy or mm/dd/yyyy.

http://www.dynamicdrive.com/dynamic...opcalendar2.htm
__________________
Hope this helps.

Mike
Royal Selangor Pewter

"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > inserting a date value into sql server (urgent!!)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT