navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Date Format Help Needed

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Date Format Help Needed
Page: [1]
 
mmoore0319

 

Posts: 25
Joined: 10/17/2005
Status: offline

 
Date Format Help Needed - 4/25/2008 14:45:06   
Hello,

How can I take a general number field and convert it to date format mm/dd/yy?

Example data that is pulled from csv file into database is 42108.

The current command used, <%=FP_FieldVal(fp_rs,"InvoiceDate")%>, produces the same output but I want it in the above mentioned format.

Using <%=FormatDateTime(FP_FieldVal(fp_rs,"InvoiceDate")%> converts the date into some odd date not even close to the original.

Any help would be appreciated.

Thanks!
rdouglass

 

Posts: 9137
From: Biddeford, ME USA
Status: offline

 
RE: Date Format Help Needed - 4/25/2008 15:16:12   
quote:

<%=FormatDateTime(FP_FieldVal(fp_rs,"InvoiceDate")%>


Did you try this way:

<%=FormatDateTime(FP_Field(fp_rs,"InvoiceDate"),VBShortDate)%>

That any better?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to mmoore0319)
rdouglass

 

Posts: 9137
From: Biddeford, ME USA
Status: offline

 
RE: Date Format Help Needed - 4/25/2008 15:17:45   
quote:

Example data that is pulled from csv file into database is 42108


Ooops. Pulling fro a CSV, eh? Are you sure it's being recognized as a date and not a number? If it were being considered a number by the DRW, then yes it would be a very strange date.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to mmoore0319)
mmoore0319

 

Posts: 25
Joined: 10/17/2005
Status: offline

 
RE: Date Format Help Needed - 4/25/2008 15:22:36   
I believe it is being recognized as a number and not a date. I have tried changing the Access column format from Number to Date/Time however, it also produces the same odd dates. I am not sure how I can correct the data in the Access database so was hoping for some insight into addressing the formatting from the webpage side of it. Of course, I would welcome a solution from the Access side as well.

(in reply to rdouglass)
Spooky

 

Posts: 26560
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Date Format Help Needed - 4/25/2008 16:53:37   
It would need to be formatted correctly when first inserted into the access database.
Im not too sure how you have that part working yet.

However, ignoring that fact and using it as a plain number, you would probably need to use VB to split out the parts you need. The problem lays in the fact you dont pad the month / date with the leading "0"

eg 11508 gives 2 options x/xx/xx or xx/x/xx
The real date needs to be 011508 so that you can easily split into 2/2/2 (or xx/xx/xx)

It may be hard to define easily which is the month and date, especially when 11508 or 11508 may be valid values

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to mmoore0319)
mmoore0319

 

Posts: 25
Joined: 10/17/2005
Status: offline

 
RE: Date Format Help Needed - 4/25/2008 17:38:47   
I'm not sure how I could do this since it is a csv file from a data dump out of AS400.

What I am doing is taking the data and importing it into an Access table. At this point, I tried to format the column as a Date but this did not help since it converted it into meaningless dates.

Yes, I understand your point. Is it possible to work backwards by taking 42008 and having the last two digits represent yy, the middle two as dd, and whatever is left over be mm?

thanks,

(in reply to Spooky)
Spooky

 

Posts: 26560
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Date Format Help Needed - 4/25/2008 19:25:07   
Im thinking not easily, as the middle 2 may not represent the date.
If there are 6 digits or 4 digits, then its real easy. Its when there are 5 the problems arise.

eg does 121 represent the 21st of Jan or the 1st of Dec? Your data will be out by 11 months.
It depends how important this is to you as both Nov and Dec would be effected

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to mmoore0319)
rdouglass

 

Posts: 9137
From: Biddeford, ME USA
Status: offline

 
RE: Date Format Help Needed - 4/28/2008 11:41:38   
quote:

csv file from a data dump out of AS400.


Just a thought.

Do you have any influence on how that comes out? See, if you could get that to be formatted MMDDYYYY (or any other date-distinguishable format) when the export is done, then it's pretty straightforward.

</$.02>

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to mmoore0319)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Date Format Help Needed
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts