Date Conversion Plugin - Forum

Forum Navigation
Climate strike banner
You need to log in to create posts and topics.

Date Conversion Plugin

Hi guys, i need a plugin or suggestion to convert date formats to something else in my pub.

Example: I'm using the lgaMonthCalendar plugin to select a date, but it returns the date as 1/2/2019

I need to convert that date to a long date or any other date formats

Thank You

Hello!

If I understand correctly, then you need commands DateToNum and NumToDate.

Or you can use the great hpwUtility plugin. This contains a DateTimePicker action group and you can set the date format with hpwUtilitySetVar "[hpwDatePattern]" ">>required date format<<" command.

Plus, you will have a calendar box with many other options so you don't need to use the lgaMonthCalendar plugin.

Quote from Vadim on September 12, 2019, 1:23 pm

Hello!

If I understand correctly, then you need commands DateToNum and NumToDate.

Hi Vadim, the NumToDate doesn't give me the correct date. I'll see if i can try something else. Thank You

Quote from JnCon on September 13, 2019, 5:51 pm

Or you can use the great hpwUtility plugin. This contains a DateTimePicker action group and you can set the date format with hpwUtilitySetVar "[hpwDatePattern]" ">>required date format<<" command.

Plus, you will have a calendar box with many other options so you don't need to use the lgaMonthCalendar plugin.

Hi JnCon, can you make me a demo pub please.

Greetings

@impactband4u

NumToDate doesn't give me the correct date

Why don't you post the exact command (with parameter values) you tried to use ... and then tell us what result you got (vs. what you expected).

 

Hi Gaev, yes sorry about that

Ok, the customer's computer date settings is set to

  1. Short date: M,d,yy
  2. Long date: dddd,MMMM dd, yyyy

Now when i use the command

SetVar "[cDate]" "[DateShort]"

from the lgaMonthCalendar plugin it return the result as 00338345864661654135 in [cDate]

Now when i use the command

NumToDate "[cDate]" "d/m/yyy" "[cDate]"

it return the result as 30/12/1899

and it must be 14/9/2019

Hope i explain it correct.

Greetings

@impactband4u

the customer's computer date settings is set to Short date: M,d,yy

When I do this ...

AlertBox "DateShort" "[DateShort]"

... I get 2019-09-14 ... and when I do ...

DateToNum "[DateShort]" "yyyy-mm-dd" "[DateShortNum]"
AlertBox "DateShortNum" "[DateShortNum]"

... I also get 43722.

I get the same result when I do ...

DateToNum "9/14/19" "m/d/y" "[DateNum]"
AlertBox "DateNum" "[DateNum]"

This looks correct as the Help file states that "The result, a numeric date, represents the number of days since December 30, 1899."

Finally ...

NumToDate "[DateShortNum]" "d/m/yyyy" "[FormattedShortDate]"
AlertBox "FormattedShortDate" "[FormattedShortDate]"

... gives me 14-9-2019

So, VisualNEOWin is doing everything correctly.

SetVar "[cDate]" "[DateShort]" from the lgaMonthCalendar plugin return the result as 00338345864661654135 in [cDate]

... not sure what you mean by "the lgaMonthCalendar plugin return the result" ... but it looks like a defect in the plugin ... or it is returning another value (like the number of milliseconds since [some time in the past]).

@luishp

There is a typo error in the Help file ...

For example, entering "d/m/yyy" will result in a date formatted as Day/Month/Year or "3/15/2008".

... should say d/m/yyyy and 15/3/2008

 

 

t

 

Quote from impactband4u on September 14, 2019, 2:06 am
Quote from JnCon on September 13, 2019, 5:51 pm

Or you can use the great hpwUtility plugin. This contains a DateTimePicker action group and you can set the date format with hpwUtilitySetVar "[hpwDatePattern]" ">>required date format<<" command.

Plus, you will have a calendar box with many other options so you don't need to use the lgaMonthCalendar plugin.

Hi JnCon, can you make me a demo pub please.

Greetings

Yes.
Download and install the hpwUtility plugin, then run the sample pub I sent.
You can set up several date formats in the combo box object or if you need only one, simply change the [DateFormat] variable in

pwUtilitySetVar "[hpwDatePattern]" "[DateFormat]"

command to required type.

 

Uploaded files:
  • You need to login to have access to uploads.