Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > date value and timestamps

Reply
Thread Tools

date value and timestamps

 
 
middletree
Guest
Posts: n/a
 
      11-25-2003
I know that if I have a full timestamp, and wrap the DateValue function
around it, it will give me mm/dd/yyyy. I can't seem to find a similar
function which would return a 2-digit year. Is there such a thing?


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      11-25-2003
AFAIK, no. Just like you can't do a formatdatetime and return "2:32 PM"
It's either "2:32:00 PM" or "14:32." I think that you'll have to manipulate
your date manually with some string manipulations or DatePart function to
return the date in the two digit year format. Just be aware that your
server may explode and your car will burst into flames when the clock
strikes midnight on the night of 12/31/2099.

Ray at work

"middletree" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I know that if I have a full timestamp, and wrap the DateValue function
> around it, it will give me mm/dd/yyyy. I can't seem to find a similar
> function which would return a 2-digit year. Is there such a thing?
>
>



 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      11-25-2003
With default regional settings, that will also return the four digit year.

Ray at work

"Peter Foti" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "middletree" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I know that if I have a full timestamp, and wrap the DateValue function
> > around it, it will give me mm/dd/yyyy. I can't seem to find a similar
> > function which would return a 2-digit year. Is there such a thing?

>
> FormatDateTime( Date, VBShortDate )
>
> Regards,
> Peter Foti
>
>



 
Reply With Quote
 
middletree
Guest
Posts: n/a
 
      11-25-2003
Thanks!


"Peter Foti" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
> news:(E-Mail Removed)...
> > With default regional settings, that will also return the four digit

year.
> >
> > Ray at work
> >
> > "Peter Foti" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > "middletree" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > I know that if I have a full timestamp, and wrap the DateValue

> function
> > > > around it, it will give me mm/dd/yyyy. I can't seem to find a

similar
> > > > function which would return a 2-digit year. Is there such a thing?
> > >
> > > FormatDateTime( Date, VBShortDate )
> > >
> > > Regards,
> > > Peter Foti

>
> Interesting. I was not aware of that.
> In that case, the "write your own" method:
>
> Function shortDateString( oDate )
> str = month( oDate ) & "/"
> str = str & day( oDate ) & "/"
> str = str & right( Year( oDate ), 2 )
> shortDateString = str
> End Function
>
> Response.Write( shortDateString( Date ) )
>
> Regards,
> Peter
>
>



 
Reply With Quote
 
dlbjr
Guest
Posts: n/a
 
      11-25-2003
This will run faster:

Function shortDateString(oDate)
If IsDate(oDate) Then
Dim ar(4)
ar(0) = Month(oDate)
ar(1) = "/"
ar(2) = Day(oDate)
ar(3) = "/"
ar(4) = Right(Year(oDate),2)
shortDateString = Join(ar,"")
End If
End Function

-dlbjr

Discerning resolutions for the alms


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Defender and Last Access timestamps issue released fix Poutnik Windows 64bit 5 03-23-2009 06:22 AM
What is the standard YAML date format that loads for timestamps? Xeno Campanoli Ruby 2 04-17-2008 02:59 PM
Date value set to current datetime, after recall the date value is null moonhk Java 5 10-11-2006 04:45 AM
Filnames and timestamps milkyway C Programming 8 09-19-2005 08:14 AM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM



Advertisments