|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
last day of month
anyone know a quick and dirty way to get the last day of the month?
|
|
#2
|
||||
|
||||
|
For what? Using what? From what?
Just off the top of my head I'd recommend looking at a calendar. ![]() |
|
#3
|
||||
|
||||
|
ok using a month from a form variable. i want to get the last day of that month automatically, without looking at a calendar
that was funny though, looking at a calendar. ha. ![]() |
|
#4
|
||||
|
||||
|
Do you want the day (Mon, Tues, etc) or the date (30th, 31st)? I assume the form variable is the month as a drop down list or something.
If you need the date of the last day of the month, I'd make a select case statement, and put the months in there, like this Code:
Select Case nameofmonthvariable
Case "January"
Response.Write("The last day is the 31st")
Case "February"
.
.
.
End Select
![]() |
|
#5
|
||||
|
||||
|
looking for the date. do you know if there are any objects or arrays inherent to asp/vbscript that have the dates for months?
|
|
#6
|
|||
|
|||
|
Don't know of any inherent arrays. I would use the look up case statement as suggested with a slight mod:
Code:
Select Case month number Case 1, 3, 5, 7, 8, 10, 12 Response.Write "31st" Case 4, 6, 9, 11 Response.Write "30th" Case 2 Response.Write "28th 0r 29th" End Select Of course, you'll need to do a bit more work for February and leap years :-) Regards, Simon. |
|
#7
|
||||
|
||||
|
Yeah, SiPeaPod's way is more efficient, but it depends on what the name of your month variable is thats being passed. If you can pass it as a number, PeaPod's way is definitely the way to go.
|
|
#8
|
||||
|
||||
|
found this on 4guysfromrolla.com
you can use dateadd("d",-1,thedate) after creating a date that is the first day of next month. very efficient. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > last day of month |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|