Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Changing the default hour and day function format

Posted on 2006-11-21
2
Medium Priority
?
152 Views
Last Modified: 2010-04-30
Hi,

I never use VB but I am looking at a DTS script that looks for the hour and day and second to have the leading 0.

so 9am on 1/1/2006 should be 0900 01012006

Here are the current functions:

the hh, mon, da and min needs to be updated.

mydate =now()
hh=Hour(time)
min=Minute(time)
yy=Year(date)
mon=Month(date)
da=DatePart("d",Date)

Thanks
0
Comment
Question by:sjsharp80
[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
2 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 17986639
mydate = Now()
hh = LZ(Hour(Time))
Min = LZ(Minute(Time))
yy = Year(Date)
mon = LZ(Month(Date))
da = LZ(DatePart("d", Date))
Stop


Here's the function:
Function LZ(str)
  LZ = str
  If (str >= 0) And (str < 10) Then LZ = "0" & str
End Function
0
 

Author Comment

by:sjsharp80
ID: 17986775
Perfect, thanks
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

647 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