|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
is this correct for DDMMYYYY? Need month to be 01, not 1
Hi
I am wanting to retrieve the current date and submit to db in DDMMYYYY format. I have got it working but am now worried that if the month was January, that the value returned would be 2812003 and not 28012003. Can anyone confirm that the below code will return 01(January) etc for the month instead of 1? Dim DateToday DateToday = Day(Date()) & Month(Date()) & Year(Date()) Response.Write DateToday (The above returns 28102003, which is what I want) Thanks, much appreciated! Lee |
|
#2
|
||||
|
||||
|
What DB are you using?
|
|
#3
|
|||
|
|||
|
Use this little trick...
It will *always* return the day for example with a 2 digit value. Dim dDay Dim dMonth Dim dYear dDay = Right(100+Day(Now()), 2) dMonth = Right(100+Month(Now()), 2) dYear = Year(Now()) Then rebuild your date... You see the trick is to add +100 and use the Right() function to retrieve the las two numbers. It will never fail and you'll always have the day and/or the month with 2 digits like what you were looking for. Hope this helps! Sincerely Vlince |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > is this correct for DDMMYYYY? Need month to be 01, not 1 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|