Date conversion syntax....

Coding + IDE + Code-Editor + Syntax + User-Functions + Anything else

Re: Date conversion syntax....

Postby Slowdown » Sat May 18, 2013 3:23 pm

Hi Gary,

In my opinion DateSerial isn't working as it should.
from the manual,
Function DateSerial(Year As Integer, Month As Integer, Day As Integer) As DateTime
' Converts a date given by year, month and day into a big number.

Returning a big number in a DateTime isn't working.
Made a small function to calculate Unix Timestamp,
Code: Select all
Function UnixTStamp(uDate As DateTime) As Integer
  Dim sDate As DateTime
  Dim Ustamp As Integer

  sDate = DateValue("1970-01-01 00:00:00")' start of date Unix timestamp
  Return DateDiff(sDate, uDate, "s")
End Function

Replace DateSerial with this function and perhaps is does the trick for you.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 464
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: Date conversion syntax....

Postby GaryVass » Tue May 21, 2013 7:36 pm

I thought those commands would work as well, but I keep getting the following error (that is why I started looking at serial dates):

SELECT from ALESSAND WHERE transDATE >= '2010-09-30';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from ALESSAND WHERE transDATE >= '2010-09-30'' at line 1


MariaDB is a drop in replacement for Mysql in Linux.....
GaryVass
 
Posts: 109
Joined: Wed May 04, 2011 8:03 pm

Re: Date conversion syntax....

Postby Henning » Tue May 21, 2013 9:58 pm

You havn't told what to return... :)

SELECT * from ALESSAND WHERE transDATE >= '2010-09-30';

/Henning
Henning
 
Posts: 522
Joined: Fri Aug 13, 2010 6:29 pm

Previous

Return to Questions & Answers

Who is online

Users browsing this forum: No registered users and 1 guest

cron