Print Page | Close Window

Problem With Date Functions

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10706
Printed Date: 31 March 2026 at 1:18pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Problem With Date Functions
Posted By: meteor
Subject: Problem With Date Functions
Date Posted: 02 June 2004 at 11:26am

Hello

I am Using date(now()) function to return Todaye Date but When i Use day() and month() functions it cant distinct between(?) day and month. date(now()) return date in this Format: 6/2/2004 that is mm/dd/yyyy but when i use function to separate day it use month. i cant change it to return date as Follow: 2004/02/05.



-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus



Replies:
Posted By: dpyers
Date Posted: 02 June 2004 at 11:47am

Try Something like....


Dim strYYYY
Dim strMM
Dim strDD
Dim dtDateNow
Dim strDateFormatted

dtDateNow = Now

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

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

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

strDateFormatted = strYYYY & "/" & strMM & "/" & strDD



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: meteor
Date Posted: 03 June 2004 at 3:04am
tanx It Work Properly. tanx DP

-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus


Posted By: dpyers
Date Posted: 03 June 2004 at 1:39pm
My pleasure.

-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net