Solved

Univ format for date: aaaammgg hh:mm:ss

Posted on 2002-04-02
7
562 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 120 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
Industry Leaders: 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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 video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

696 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