Register  |  Login



Question

Status: Open Points: 75 Time: 02:42 - Jun 07, 2007  

manohar.patil

Question related to split the whole string?

I have a .asp page in which I declare a dim named as strUpdated, actually it contain the date format in following way
6/5/2007 11:46:38 AM
now I want to split this strUpdated in 6/5/2007 11:46 AM this format means I want to remove the second field so please suggest the funtion which help me to do this Or give any user define funtion forward me ?
Thank You,

Categories:

asp
Answer Discussion
Answer Summaries

 

Q&A System for Websites and Corporate Collaboration

Advertisement

  • Generates significant organic traffic for websites
  • Saves companies money, resources, and time

nidhi

Date:: Jun 07, 2007

Time:: 03:28

Is this ASP or ASP.Net?

How did u get the date? Is it today's date?

You could just use the formatting options to return just the date part
otherwise use the Split method and take out the value from subscript 0

manohar.patil

Date:: Jun 07, 2007

Time:: 03:39

this is ASP
I get date from stored Procedure, and it may be any date
I don't want to change the return format of stored Procedure
how do i use the formatting option please give example
Thank you

nidhi

Date:: Jun 07, 2007

Time:: 03:42

ASP

get current date, use DATE() so this returns 6/5/2007
get current time, use TIME() so this returns 11:46:38
get current date/time, use NOW()

in ASP u could also try using FormatDateTime
eg FormatDateTime('6/5/2007 11:46:38',2)
the 2nd parameter 2 means to return the short date format i.e. 6/5/2007

How to use Split
Dim sStr

sStr = Split('6/5/2007 11:46:38 AM',' ')
Response.Write sStr(0) 'returns 6/5/207

nidhi

Date:: Jun 07, 2007

Time:: 03:43

Ok, just saw your reply. I was about to post ASP.net version but wont bother now.

Ok, if stored procedure returning string, see if it works in FormatDateTime or try Split

manohar.patil

Date:: Jun 07, 2007

Time:: 04:44

It works
Thanks for your cooperation
But available format does not contain the am pm format
so for this need to write funtion?
can we do addition or subtraction between time variable(dim t)?

nidhi

Date:: Jun 07, 2007

Time:: 05:57

sorry, can u tell me what the exact output you want?
do u want

'6/5/2007 AM

admin

Date:: Aug 22, 2007

Time:: 20:22

manohar.patil, did you get your question solved?

If you did then please close this question and distribute the points. If you found the solution on your own, we would be very happy if you could explain it here for the sake other users having the same problem.

If you didn't get a solution to your problem, please leave a comment here to let the experts know that you're still looking for an answer.

Thanks,
The Quomon Admin Team

shashi.programmer

Date:: Sep 27, 2007

Time:: 04:20

i think this can help you...

response.write(FormatDateTime(date(),vbgeneraldate)) /// for date 9/27/2007
response.write(FormatDateTime(now(),vbshorttime)) /// for time 02:50 AM

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Summaries cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top asp Experts

View More

Rank

Expert

Points

1.

lclbus

250

2.

jgivoni

225

3.

PeterNZ

200

4.

redcharcoal

100

5.

Anpanman

65

6.

rcastagna

50

7.

nidhi

25

8.

multani.sarbjit

10

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es