Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Date formatting
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

kolucoms6
Average Member

845 Posts

Posted - 05 December 2007 :  15:30:35  Show Profile

I have one date format as November/2007.

I want to convert it to 1107

Any Suggestions ?

AnonJr
Moderator

United States
5768 Posts

Posted - 05 December 2007 :  15:50:19  Show Profile  Visit AnonJr's Homepage
A little more context would help... for example: Is that how it is stored in the database? Or are you getting that as input from somewhere else?
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 05 December 2007 :  16:45:43  Show Profile
In DB its November/2007

In text report, I need to print 1107
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 05 December 2007 :  17:08:56  Show Profile  Visit AnonJr's Homepage
Assuming that you've got a recordset called "rs" and that the date is in a field called "date":

strDate = Month(Left(rs("date"),(InStr(rs("date"),"/")-1))) & Year(Right(rs("date"),(InStr(rs("date"),"/")+1)))


I'm almost positive that there is a more elegant and/or proper way to do it, but that's my first run. Just keep in mind that I didn't test it, so there might be something that my decaffeinated brain missed.

Oh, and before I forget:

  • Jan through Sept. will not have the leading zero as Month() gives you 1 through 9 for the appropriate month - if a 2 digit month is absolutely needed you will have to pad accordingly.

  • Year() gives a 4 digit year - if a 2 digit year is absolutely needed you will have to trim accordingly.

Edited by - AnonJr on 05 December 2007 17:13:47
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 07 December 2007 :  13:37:16  Show Profile  Send pdrg a Yahoo! Message
Be alert - if it's stored in the db as November/07 that's a bit of plaintext, which could be misspelled, be padded with spaces, etc, which could be problematic
Go to Top of Page

asmgssl
Starting Member

Sri Lanka
7 Posts

Posted - 09 December 2007 :  08:27:05  Show Profile  Send asmgssl a Yahoo! Message
How can Display record set date Day Month Year
Go to Top of Page

asmgssl
Starting Member

Sri Lanka
7 Posts

Posted - 09 December 2007 :  08:28:10  Show Profile  Send asmgssl a Yahoo! Message
asp code for upload multi record to server database
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07