pgDateFormat

Help for using specific functions

pgDateFormat

Postby John Robin Dove » Fri Feb 20, 2015 3:31 pm

Hi Clifton,

I would like to format this "2015-02-20'T'16:01:00" to seconds. Is it a recognizable date string? It's from the pgDateFormat "isoDateTime" output mask. I want to return it to seconds or milliseconds so that I can compare it with the current date and time. So far I've only got an NaN error.

Update: This: var msec = Date.parse("2015-02-20T16:01:00") works here http://www.w3schools.com/js/tryit.asp?filename=tryjs_date_convert but I can't do with pgDateFormat. Maybe Ishould try exeJavascriptDirect?
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: pgDateFormat

Postby John Robin Dove » Sat Feb 21, 2015 4:55 am

Managed to do this with exeJavaDirect.

local variable dateStr = "2015-02-20T16:01:00"
commandString parameter: "var msec = Date.parse('" & dateStr & "'); return msec;"

Image
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: pgDateFormat

Postby Clifton » Sat Feb 21, 2015 5:57 am

Nice post!
pgDateFormat() was not really designed to go back to a milliseconds format by inputting a masked date. We will consider this modification to the function, but your workaround is perfectly fine.
exeJavascriptDirect() was included in the PowerPac to provide a bridge for unusual or complex tasks for which there is no function.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: pgDateFormat

Postby Clifton » Sun Feb 22, 2015 9:56 am

Latest PowerPac beta adds the functionality you described above to pgDateFormat(). It streamlines it to support UTC, etc. A few bug fixes too. You can download it HERE.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am


Return to Function Help

Who is online

Users browsing this forum: No registered users and 5 guests

cron