?
Solved

Univ format for date: aaaammgg hh:mm:ss

Posted on 2002-04-02
7
Medium Priority
?
566 Views
Last Modified: 2008-02-26
Kind all,
        does anybody can kinldy indicate to me how can I format date in a way I can insert them into the DB in the
univ. format for date: aaaammgg hh:mm:ss

Tnx n regards

D
0
Comment
Question by:getronick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Expert Comment

by:John844
ID: 6913574
I am not sure what aaaammgg is, but I will guess aaaa is the year with century and gg is the day

dim strNewValue
dim datDate

datDate = now()

strNewValue = year(datDate) & right("0" & month(datDate),2) & right("0" & day(datDate),2) & " " & right("0" & hour(datDate),2) & ":" & right("0" & minute(datDate),2) & ":" & right("0" & second(datDate),2)

response.write "New value to store = " & strNewValue


John
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 6913575
MyDate = Year(Now) & "/" & Month(Now) & "/" & Day(Now) & " " & Time

instead of now you can put your date..


or also you can use formatdatetime function

MyDate = FormatDateTime(Now,1)   .. test it from 0 to 4 i guess..
0
 
LVL 11

Accepted Solution

by:
thunderchicken earned 360 total points
ID: 6913576
ugly, but it will work

dim strTemp, yourdate
strTemp = ""
yourdate = now()
strTemp = strTemp & year(yourdate)
if len(month(yourdate)) = 1 then
  strTemp = strTemp & "0" & month(yourdate)
else
  strTemp = strTemp & month(yourdate)
end if
if len(day(yourdate)) = 1 then
  strTemp = strTemp & "0" & day(yourdate)
else
  strTemp = strTemp & day(yourdate)
end if
if len(hour(yourdate)) = 1 then
  strTemp = strTemp & "  0" & hour(yourdate)
else
  strTemp = strTemp & "  " & hour(yourdate)
end if
if len(minute(yourdate)) = 1 then
  strTemp = strTemp & "0" & minute(yourdate)
else
  strTemp = strTemp & "  " & minute(yourdate)
end if
if len(second(yourdate)) = 1 then
  strTemp = strTemp & "0" & second(yourdate)
else
  strTemp = strTemp & second(yourdate)
end if


response.write strTemp

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:ebosscher
ID: 6913845
umm.. this may seem overly simplistic, but why not use the DateTimeFormat("string", vbLongDate)?
0
 
LVL 7

Expert Comment

by:John844
ID: 6913967
obosscher,
FYI, DateTimeFormat does not exist.  FormatDateTime does exist, but still does not return the requested date format.  FormatDateTime(Now(),vbLongDate) returns "Tuesday, April 02, 2002"
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 6913974
wow.. I was way out.. thanks John844.. my bad
0
 
LVL 7

Expert Comment

by:John844
ID: 6925882
are you still needing more info getronick???
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question