You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

woz

Beginner

  • "woz" started this thread

Posts: 7

Date of registration: Oct 11th 2012

  • Send private message

1

Friday, October 12th 2012, 4:12pm

Now function

Searching for "now" on forums yielded too much obsolete stuff....
How can I call the equivelant of Now() ?
Wºz™

fomaxrge

Trainee

Posts: 88

Date of registration: Aug 14th 2012

  • Send private message

2

Friday, October 12th 2012, 4:31pm

where do you want to appear it?
Label, textbox? what ?

for example if you have a label "test" then...
test.Caption = now

This post has been edited 1 times, last edit by "fomaxrge" (Oct 12th 2012, 4:37pm)


woz

Beginner

  • "woz" started this thread

Posts: 7

Date of registration: Oct 11th 2012

  • Send private message

3

Friday, October 12th 2012, 4:55pm

Jabaco Source

1
2
Dim Dob As String = InputBox("Please enter the Date Of Birth:", "DOB")
   age = DateDiff("d",Dob,now) msgbox age

...does nothing so i tried....

Jabaco Source

1
2
Dim Dob As String = InputBox("Please enter the Date Of Birth:", "DOB")Dim todate as datetodate = now()
   age = DateDiff("d",Dob,todate)msgbox age

...also tried....

Jabaco Source

1
2
Dim Dob As String = InputBox("Please enter the Date Of Birth:", "DOB")Dim todate as now()
   age = DateDiff("d",Dob,todate) msgbox age

....nothing is returned...no msgbox..nada :(
...stupid forum seems to wrap my code....its setout correctly.

Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

4

Saturday, October 13th 2012, 9:47am

Hey there,

from my experiance with Jabaco the Format and Date -related functions don't allways work as expected!
So you might be better off doing some dirty stringmanipulations.
Just do get this working look at this

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Option Explicit
Public Sub Form_Load()
   Dim Dob As String = InputBox("Please enter the Date Of Birth:", "DOB")
   '2012/10/01
   'expected inputformat for DateDiff -> dd.MM.yyyy
   MsgBox DateDiff("d", MyDate(Dob), MyDate(Now))
End Sub

Public Function MyDate(d As String) As Date
'Input  -> yyyy/mm/dd
'Output -> dd.mm.yyyy
   Dim sdt() As String 
   Dim sd() As String 
   sdt = Split(d," ")
   sd = Split(sdt(0),"/")
   MyDate = CDate(sd(2) & "." & sd(1) & "." & sd(0))
'   If UBound(sdt)> 0 Then MyDate = MyDate & " " & sdt(1)
End Function

'https://code.google.com/searchframe#pOD0Tthq4jU/trunk/Framework/src/VBA/DateTime.java&q=DateDiff%20package:jabacoframework%5C.googlecode%5C.com
'


Dani

This post has been edited 1 times, last edit by "Dani" (Oct 13th 2012, 11:01am)


Rate this thread
WoltLab Burning Board