Jump to content

Date calculation needed


This topic is 759 days old. Please don't post here. Open a new topic instead.

Recommended Posts

May I ask, I'm making database with ID, DATE and NAME, but I want if I input DATE for example day(2digit),month(2digit)and year(4digit) and I enter it will be automatic in the ID it say year(4digit)month(2digit)day(2digit) and there is 0001 behind day. for example date:25-02-2022 if I enter the ID must be like 20220225-0001 it will be like that and automatically sequentially.

sorry if my English is not good. I'm Dedy from Jakarta, Indonesia

Link to comment
Share on other sites

8 hours ago, D3D1 said:

if I enter the ID must be like 20220225-0001 it will be like that and automatically sequentially.

I don't understand this part. If you want sequential ID, then you (as the user) cannot be entering your own.

Also, it's not clear what exactly "sequential" means here. Do you want to restart the sequence at the beginning of each day? If so, you are looking at further complication, because Filemaker does not have a built-in mechanism for this. Is your solution hosted on FM Server?

 

  • Like 1
Link to comment
Share on other sites

56 minutes ago, Steve Martino said:

Simple version

The date part of your calculation does not distinguish between Jan 21 and Dec 1 (for example). The correct expression for a 6-digit YYMMDD result, as indicated in the question, would be:

Right ( Year ( date ) ; 2 ) & SerialIncrement ( "00" ; Month ( date ) ) & SerialIncrement ( "00" ; Day ( date ) )

or, if you prefer:

SerialIncrement ( "000000" ; 10^4 * Mod ( Year ( date ) ; 100 ) + 10^2 * Month ( date ) + Day ( date ) )

 

Edited by comment
  • Like 1
Link to comment
Share on other sites

20 hours ago, comment said:

The date part of your calculation does not distinguish between Jan 21 and Dec 1 (for example). The correct expression for a 6-digit YYMMDD result, as indicated in the question, would be:

Right ( Year ( date ) ; 2 ) & SerialIncrement ( "00" ; Month ( date ) ) & SerialIncrement ( "00" ; Day ( date ) )

or, if you prefer:

SerialIncrement ( "000000" ; 10^4 * Mod ( Year ( date ) ; 100 ) + 10^2 * Month ( date ) + Day ( date ) )

 

Nice!

  • Like 1
Link to comment
Share on other sites

what if from 2022 to 2023 but the id of the number 0001 is again like the beginning again, for example the id becomes 230101-0001

Link to comment
Share on other sites

On 2/27/2022 at 1:06 AM, comment said:

The date part of your calculation does not distinguish between Jan 21 and Dec 1 (for example). The correct expression for a 6-digit YYMMDD result, as indicated in the question, would be:

Right ( Year ( date ) ; 2 ) & SerialIncrement ( "00" ; Month ( date ) ) & SerialIncrement ( "00" ; Day ( date ) )

or, if you prefer:

SerialIncrement ( "000000" ; 10^4 * Mod ( Year ( date ) ; 100 ) + 10^2 * Month ( date ) + Day ( date ) )

 

I will try my best, thank for your help 

Link to comment
Share on other sites

This topic is 759 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.